Linux sshssh免密碼認證
[[email protected] ~]# ssh-keygen -t rsa #創建密鑰對
Generating public/private rsa key pair
Enter file in which to save the key (/root/.ssh/id_rsa):
Created directory ‘/root/.ssh‘.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
The key fingerprint is:
e0:19:93:d6:0d:fc:3f:7d:fd:b1:67:af:63:bc:d4:67 [email protected]
The key‘s randomart image is:
+--[ RSA 2048]----+
| .. |
| o.o |
| * ... |
| o = . |
| o S . . .|
| o .oo|
| .+o=|
| .o=+|
+-----------------+
[[email protected] ~]# ssh-copy-id -i .ssh/id_rsa.pub [email protected] #部署公鑰到KVM服務器
The authenticity of host ‘10.0.0.20 (10.0.0.20)‘ can‘t be established.
ECDSA key fingerprint is c3:a2:bc:39:7d:a5:fd:f5:8a:93:28:fd:e6:4c:29:7b.
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
[email protected] password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh [email protected]"
and check to make sure that only the key(s) you wanted were added.
[[email protected] ~]# ssh-copy-id -i .ssh/id_rsa.pub [email protected] #部署公鑰到KVM服務器
The authenticity of host ‘10.0.0.30 (10.0.0.30)‘ can‘t be established.
ECDSA key fingerprint is c3:a2:bc:39:7d:a5:fd:f5:8a:93:28:fd:e6:4c:29:7b.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
[email protected] password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh [email protected]"
and check to make sure that only the key(s) you wanted were added.
[[email protected] ~]#
[[email protected] ~]# ssh 10.0.0.20 #測試登陸服務器
Last login: Tue May 16 22:27:43 2017 from controller
[[email protected] ~]# ssh 10.0.0.30 #測試登陸服務器
Last login: Tue May 16 22:28:11 2017 from controller
本文出自 “gswcfl” 博客,請務必保留此出處http://guoshiwei.blog.51cto.com/2802413/1926443
Linux sshssh免密碼認證