ssh-key

[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 [email protected]
The key's randomart image is:
+--[ RSA 2048]----+
|     .... .   oEo|
|      ..ooo .  .o|
|       . .*+ . +.|
|         * =. =  |
|        S = .  . |
|         o .     |
|                 |
|                 |
|                 |
+-----------------+
[root@localhost ~]# ssh-copy-id -i ~/.ssh/id_rsa.pub [email protected] -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
[email protected]'s password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh -p '22222' '[email protected]'"
and check to make sure that only the key(s) you wanted were added.

[root@localhost ~]# ssh -p 22222 [email protected]
Last login: Mon Sep 10 13:57:36 2018 from yyy.yyy.yyy.yyy
[tom@vm-server ~]$ 

你可能感兴趣的:(ssh-key)