#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:
SHA256:vpH9ZmR21RJ8nMCKL5CAPnqp+FHjrmbSBMDMKJJcEHQ root@aminglinux-128
The key’s randomart image is:
±–[RSA 2048]----+
|B=+E. .o…|
|*=… . .o.o|
|+ . . . . . o.|
|. o o . . . o|
| … = S . o |
| …= . . + .+ . |
|.o+ . + o+ . |
|o.+o o .o |
| =o… . o. |
±—[SHA256]-----+
[root@aminglinux-128 .ssh]# cat /root/.ssh/id_rsa.pub (复制下面的AAA之后起)
ssh-rsa AAAA*********8
初始化远程连接记得要重启才有.ssh文件
[root@aminglinux-128 .ssh]# vim /root/.ssh/authorized_keys
[root@aminglinux-128 .ssh]# chmod 600 /root/.ssh/authorized_keys
[root@aminglinux-128 .ssh]# exit