#############可选,无密码openssh登录 ##########
ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa #创建密钥对
ssh-copy-id -i ~/.ssh/id_rsa.pub test@chenlianfu.com
ssh test@chenlianfu.com
#############################################
[train@MiWiFi-R3P-srv ~]$ ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa
Generating public/private rsa key pair.
Your identification has been saved in /home/train/.ssh/id_rsa
Your public key has been saved in /home/train/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:KD7ULYDo8P9e/my1kOR6Euhglh1flPBtbUAzOYPZ3uQ train@MiWiFi-R3P-srv
The key's randomart image is:
+---[RSA 3072]----+
| .. *=. |
| . . .=.==. |
|o . . ...o*o |
|o. o.o o...E |
| .. oo++S+ . |
| +=.o.o + . |
| o+o .o o . |
| o.oo.o . |
| .o .=o |
+----[SHA256]-----+
[train@MiWiFi-R3P-srv ~]$ cat ~/.ssh/
id_rsa id_rsa.pub known_hosts known_hosts.old
[train@MiWiFi-R3P-srv ~]$ cat ~/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCkdttiY0F4gj4gajUA5owhSLZsvsN8KPTP7lwIzhDC88wpeGhX4BqNMumeTSsoEVnxyKZkC3v7LZl+BN/3vOIunwJHHN8//huIrvwOnbF6xzRBTIFy+9kqyVYtxiQ2EZL1TOwgs54u30Y08ga9/C9dkTNw3MXPpb762mraCxa2frQsn20W/Qx0BzOSkqVQ95sGAVML4NjWPd0HbHspSvsS93hAQcYgJXQ/NfXaBLufoXvz04q1j8YxvLbNW1jnGmCcV132Lu0FVNbznLhSQ9SnIfSwobT6R5uZe4+X67clsA2301hN8+2BUQKplg4f0D/tpiadM8AuTew6uJPrh7THQuTNg8Cyy6dgswshcgG7n2Tl0xVQbcq1ZiJ64QzffVyJFYEh1yaIf4Z7ff98wvdchlk7eziQs7AtYKZJBAm8obI87PHeazjrTffU7llE4ARmHKk2Cy21fp9FAMWwGXXi0VK2Yf13rBYiQuDmvb9MtmaBiUYK8Ll9bf9DBQjWiVM= train@MiWiFi-R3P-srv
进入另一台服务器将该密钥粘贴到~/.ssh/authorized_keys文件中
ssh test@chenlianfu.com进行登陆,首次登陆需要密码
网友评论