linux下SSH互信


linux中SSH互信

 
node8:192.168.0.218
node9:192.168.0.219
node8節點生成密鑰對,公鑰發給node9,node8通過ssh連接node9不再輸入密碼

[root@node8 ~]# ssh-keygen
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:
4e:5e:17:18:0f:c2:60:b1:ad:9b:fb:3d:cc:b9:03:41 [email protected]
The key's randomart p_w_picpath is:
+--[ RSA 2048]----+
| ++. o |
| . oE. = |
| ... . o |
| .. . |
| . S.. . |
| *.. . |
| o o+ . |
| . .* |
| ... o+ |
+-----------------+

[root@node8 ~]# ls .ssh/id_rsa
id_rsa id_rsa.pub

[root@node8 ~]# ssh-copy-id --help
Usage: /usr/bin/ssh-copy-id [-i [identity_file]] [user@]machine

[root@node8 ~]# ssh-copy-id -i .ssh/id_rsa.pub 192.168.0.219
The authenticity of host '192.168.0.219 (192.168.0.219)' can't be established.
RSA key fingerprint is ed:6a:c8:ff:f3:0f:e8:1c:53:d2:89:09:d6:fb:d2:73.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.0.219' (RSA) to the list of known hosts.
[email protected]'s password:
Now try logging into the machine, with "ssh '192.168.0.219'", and check in:

.ssh/authorized_keys

to make sure we haven't added extra keys that you weren't expecting.

[root@node8 ~]# ls .ssh/
authorized_keys id_rsa id_rsa.pub known_hosts
[root@node8 ~]# ssh 192.168.0.219
Last login: Mon Aug 20 14:01:59 2012 from 192.168.0.108
[root@node9 ~]# 
 
 
 
 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章