[英]SSH Key Exchange with alternate user
So I am using RHEL 7. I have two servers with the following user accounts所以我使用的是 RHEL 7。我有两台具有以下用户帐户的服务器
I want the setup to work in the following manner.我希望设置按以下方式工作。
passwordless SSH from server 1 to server 2 using the admin
user, but the SSH initiation is done from the root
user always.使用
admin
用户从服务器 1 到服务器 2 的无密码 SSH,但 SSH 启动总是从root
用户完成。
We are not allowed to do ssh key exchange for the root
user, but the app that we are working with uses root to ssh to the other nodes.我们不允许为
root
用户进行 ssh 密钥交换,但是我们正在使用的应用程序使用 root ssh 到其他节点。
I hope I am making sense here :)我希望我在这里说得通:)
SSH using root
user to server2, but internally it should use admin
user's key and connect to server2 using admin user. SSH 使用
root
用户连接到 server2,但在内部它应该使用admin
用户的密钥并使用 admin 用户连接到 server2。
I have tried to confiure /etc/ssh/ssh_config
file and added host/user config there, now I am able to run ssh server2
from root
user and it connects to server2 using my defined admin user in the ssh_config file but it prompts for a password every time which I don't want.我试图配置
/etc/ssh/ssh_config
文件并在那里添加主机/用户配置,现在我可以从root
用户运行ssh server2
并且它使用我在 ssh_config 文件中定义的管理员用户连接到 server2 但它提示输入每次我不想要的密码。
Key exchange with admin
is already done and tested to be working fine when I issue ssh as admin
user.当我以
admin
用户身份发出 ssh 时,与admin
密钥交换已经完成并经过测试可以正常工作。
Thanks in advance.提前致谢。
In the same file /etc/ssh/ssh_config
you need to add the key to use, something like this:在同一个文件
/etc/ssh/ssh_config
您需要添加要使用的密钥,如下所示:
Host srv2
User admin
IdentityFile /home/admin/.ssh/id_rsa
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.