您的位置:首页 > 其它

ubuntu12.04-- ssh免密码登录

2016-09-26 13:44 197 查看
1.将当前主机A的用户切换为root用户

2.执行ssh-keygen -t rsa,默认三次回车

root@wifi:~# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
f0:d2:f8:49:66:c4:e6:40:dc:9a:0f:79:ae:72:e8:6e root@wifi
The key's randomart image is:
+--[ RSA 2048]----+
| ... |
| .... |
| o++ |
| =X. |
| o=S |
| *o. |
| . .o |
| E o |
| +oo |
+-----------------+

3.将/root/.ssh/id_rsa.pub拷贝到主机B的对应目录下,然后将其内容导入到文件authorized_keys中
cd /root/.ssh
cat id_rsa.pub > authorized_keys

4.重启sshd服务
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: