配置SSH无密码登录问题解决记录

在本地测试搭建hadoop玩以下,不想在ssh配置上栽了了,记录以下过程和处理方式:
hadoop@debian:~$ ssh-keygen -t rsa  #一直回车生成
hadoop@debian:~$ cd
hadoop@debian:~$ cd .ssh/
hadoop@debian:~/.ssh$ ls
id_rsa  id_rsa.pub
hadoop@debian:~/.ssh$ cat id_rsa.pub >> authorized_keys
hadoop@debian:~/.ssh$ ls
authorized_keys  id_rsa  id_rsa.pub
hadoop@debian:~/.ssh$ chmod 600 authorized_keys
hadoop@debian:~/.ssh$ chmod 700 ../.ssh  #目录权限必须设置700
#开启RSA认证,指定认证key文件。
root@debian:/data1# vim /etc/ssh/sshd_config
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile      %h/.ssh/authorized_keys

问题。。。。。。。。。
但是在登录的时候却发现了这个问题:要求输入密码。
helight:.ssh$ ssh localhost
Agent admitted failure to sign using the key.
helight@localhost’s password:
解決方式 使用 ssh-add 指令将私钥加进来
helight:.ssh$ ssh-add ~/.ssh/id_rsa
再通过ssh 主机名 就可以实现无密码登录了。

Leave a Reply

Your email address will not be published. Required fields are marked *