ssh无密码登录失败
的有关信息介绍如下:我们在Linux中有时候经常使用到ssh远程登录到另外一台Linux系统。在配置ssh中可能会出现失败,如:Agent admitted failure to sign using the key
在主机上,需要使用ssh登录到另外一台机子上,比如:A主机借助ssh无密码登录。这时可能会出现Agent admitted failure to sign using the key情况。
在A中输入:cd ~/.ssh
如果提示没有此目录,可以输入:ssh localhost
接着在A中输入:ssh-keygen -t rsa
生成秘钥ssh-keygen -t rsa
紧接着A中继续输入:cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
确保A能无密码登录到A中。可以使用ssh localhost来验证。
在A中执行上面的命令时若提示:Agent admitted failure to sign using the key,之后要输入A的密码。则可以输入:ssh-add,让A强行加入秘钥。然后重新执行第四步
还是A中:scp ~/.ssh/id_rsa.pub hadoop@B:/home/hadoop/
这里hadoop@B是B机器
命令的意思把A中生成的id_rsa.pub发送到B中
命令输入后需要输入B机器的密码,然后等待传输完毕
在B中输入:cat ~/id_rsa.pub >> ~/.ssh/authorized_keys
命令的意思是把A生成的id_rsa.pub保存在B中的~/目里(即根目录)
在A中输入:ssh B
此时可能出现Agent admitted failure to sign using the key提示,表示A还不能无密码登录到B
此时,可以在B中输入ssh-add 这是前行加入A的秘钥
此时,在A中再次输入ssh B 就能无密码登录到B中了。