Permission denied (publickey). 解决方法

原因

生产机器默认禁用了ssh密码登录权限。

 

解决方案一,sshkey

主机一:

ssh-keygen -t rsa

将生产的pub文件拷贝到主机二上

主机二:

root@spark3:~# cat 1.pub >> .ssh/authorized_keys
root@spark3:~# chmod 600 .ssh/authorized_keys
root@spark3:~# chmod 700 .ssh

解决方案二,允许ssh密码登录权限

  1. 登录目标机器 打开 /etc/ssh/sshd_config ,修改PasswordAuthentication no 为:

PasswordAuthentication yes

  1. 重启服务

/etc/init.d/sshd restart

posted @ 2019-06-11 16:38  学海无涯苦作舟_书山有路勤为径  阅读(54544)  评论(1编辑  收藏  举报