http://blog.csdn.net/leexide/article/details/17252369
https://my.oschina.net/aiguozhe/blog/33994
process:
local server:
1. ssh-keygen -t rsa (连续三次回车,即在本地生成了公钥和私钥,不设置密码)
2. ssh root@172.24.253.2 "mkdir .ssh;chmod 0700 .ssh" (需要输入密码, 注:必须将.ssh的权限设为700) (if remote server doesn't have ssh file)
3. scp ~/.ssh/id_rsa.pub root@172.24.253.2:.ssh/id_rsa.pub (需要输入密码)
remote server:
1.
cat id_rsa.pub >> ~/.ssh/authorized_keys
2.
chmod 600 authorized_keys 3.
chmod 700 -R ~/.ssh
注意都要在对应.ssh 文件目录下进行
No comments:
Post a Comment