Linux ssh免密碼認證

[root@localhost ~]# 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.
Your public key has been saved in /root/.ssh/id_rsa.pub.
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..E|
|             .+o=|
|             .o=+|
+-----------------+
[root@localhost ~]# 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.
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]'s 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.

[root@localhost ~]# 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]'s 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.

[root@localhost ~]#

[root@localhost ~]# ssh 10.0.0.20 #測試登陸服務器
Last login: Tue May 16 22:27:43 2017 from controller

[root@localhost ~]# ssh 10.0.0.30 #測試登陸服務器

Last login: Tue May 16 22:28:11 2017 from controller



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章