MacBook-Pro-M:~ xuxiansheng$ cd // 当前目录cd 回到当前用户目录下
MacBook-Pro-M:~ xuxiansheng$ ssh-keygen -t rsa //输入命令后连续三次回车
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/xuxiansheng/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/xuxiansheng/.ssh/id_rsa.
Your public key has been saved in /Users/xuxiansheng/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:xlTSo5t3259M/nDGTY6Wj7+97G9XdeggfkoMImHeQeGx0 xuxiansheng@MacBook-Pro-M.local
The key's randomart image is:
+---[RSA 2048]----+
| .+.Z . ..|
| + =do ....|
| . O.o. .+ |
| *.= . .|
| Do ..|
| .o . . *o|
| . . o=.N|
| ..**=|
| o%&|
+----[SHA256]-----+
MacBook-Pro-M:~ xuxiansheng$ // 三次回车后的样子
MacBook-Pro-M:.ssh xuxiansheng$ ssh-copy-id root@192.22.168.110 -p 22
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/Users/xuxiansheng/.ssh/id_rsa.pub"
The authenticity of host '[192.22.168.110]:22 ([192.22.168.110]:22)' can't be established.
RSA key fingerprint is SHA256:EXpOj8VFXnE223dfp3fFh8WpDUpMWjXRzxd5C8Tnx14.
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
root@192.22.168.110's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh -p '22' 'root@192.22.168.110'"
and check to make sure that only the key(s) you wanted were added.
MacBook-Pro-M:.ssh xuxiansheng$
ssh免密登陆
MacBook-Pro-M:.ssh xuxiansheng$ ssh root@192.22.168.110 -p 22
Last login: Wed Nov 18 16:39:08 2020 from 192.168.1.11
Welcome xuxiansheng@MacBook-Pro-M.local !
[root@CY-DB-1_192.22.168.110 ~]#
[root@CY-DB-1_192.22.168.110 ~]# //登陆成功
在当前用户下MacBook-Pro-M:~ xuxiansheng$ cd // 当前目录cd 回到当前用户目录下MacBook-Pro-M:~ xuxiansheng$ ssh-keygen -t rsa //输入命令后连续三次回车Generating public/private rsa key pair.Enter file in which to save the key (/Users/xuxiansheng/.ssh/id_rsa): Enter passphrase (emp