[root@localhost ~]# ssh-keygen -t rsa -b 2048 -P '' -f ~/.ssh/id_rsa
Generating public/private rsa key pair.
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:
73:0d:da:43:4b:36:24:c2:6d:77:f2:9d:39:15:7c:41 root@localhost.localdomain
The key's randomart image is:
+--[ RSA 2048]----+
| .... . oEo|
| ..ooo . .o|
| . .*+ . +.|
| * =. = |
| S = . . |
| o . |
| |
| |
| |
+-----------------+
[root@localhost ~]# ssh-copy-id -i ~/.ssh/id_rsa.pub tom@xxx.xxx.xxx.xxx -p 22222
/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
tom@xxx.xxx.xxx.xxx's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh -p '22222' 'tom@xxx.xxx.xxx.xxx'"
and check to make sure that only the key(s) you wanted were added.
[root@localhost ~]# ssh -p 22222 tom@xxx.xxx.xxx.xxx
Last login: Mon Sep 10 13:57:36 2018 from yyy.yyy.yyy.yyy
[tom@vm-server ~]$
ssh-key
最新推荐文章于 2025-06-03 14:56:24 发布