我有几个服务器和不同的用户。 另外我有两个不同的授权方法:通过密钥和密码。
当我尝试loginSSH重新检查所有的公钥。 有没有方法来绑定公钥和服务器?
这里是详细的:
ssh -v root@serv debug1: Offering RSA public key: /home/user/.ssh/id_rsa debug1: Authentications that can continue: publickey,password debug1: Offering RSA public key: user1@web3 debug1: Authentications that can continue: publickey,password debug1: Offering RSA public key: user2@web2 debug1: Authentications that can continue: publickey,password debug1: Offering RSA public key: root@web1 debug1: Authentications that can continue: publickey,password debug1: Offering RSA public key: user3@web3
您可以使用〜/ .ssh / config文件,并将每个主机configuration的详细信息放在里面
Host serv1 hostname serv1.example.com user serv1user IdentityFile ~/.ssh/serv1user.key Host serv2 hostname serv2.example.com user root IdentityFile ~/.ssh/rootserv2.key Host serv3 user root IdentityFile ~/.ssh/rootserv3.key
现在你可以ssh serv1等,相关的细节将被从configuration文件中拾取。