Linux sshssh免密码认证

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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.
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=+|
+-----------------+
[[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.
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.

[[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]10.0.0.30‘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.

[[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免密码认证的主要内容,如果未能解决你的问题,请参考以下文章

Linux ssh安全设置,及免密码登录

windows文件备份到linux:windows定时任务+cwrsync+ssh免密码认证

Linux CentOS7 两台机器之间免输入密码相互登录(密钥对认证)

ssh免密码登录设置

Linux之间配置SSH互信(SSH免密码登录)

Linux之间配置SSH互信(SSH免密码登录)