1. 程式人生 > >ssh免秘鑰登錄

ssh免秘鑰登錄

gin ide -c color 5.0 air size 創作 enc

SSH免秘鑰登錄

原創作品,允許轉載,轉載時請務必以超鏈接形式標明文章 原始出處 、作者信息和本聲明。否則將追究法律責

[[email protected] ~]# 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:
25:4b:57:51:1a:fc:c8:73:a8:6d:c9:a1:89:4a:29:90 [email protected]
The key‘s randomart image is:
+--[ RSA 2048]----+
| .+o. |
| ..o |
| . o o..+ |
| E . = * o |
| . .S. * = |
| . o . + = |
| o . . |
| . |
| |
+-----------------+

[[email protected] ~]# ssh-copy-id -i
/root/.ssh/id_rsa.pub 192.168.115.81

[email protected]‘s password:
Now try logging into the machine, with "ssh ‘192.168.115.81‘", and check in:

.ssh/authorized_keys

to make sure we haven‘t added extra keys that you weren‘t expecting.

[[email protected] ~]# ssh 192.168.115.81
Last login: Sat Sep 30 07:33:13 2017 from 192.168.115.118
[[email protected] ~]# ifconfig

...

eth1 Link encap:Ethernet HWaddr 00:0C:29:33:36:3F

inet addr:192.168.115.81 Bcast:192.168.115.255 Mask:255.255.255.0
...

ssh免秘鑰登錄