ssh22端口和非22端口建立秘鑰的使用方法
ssh鏈接:
ssh [email protected]
ssh -p 22222 [email protected]
輸入密碼登陸
ssh不用收入密碼建立密鑰
1、生成秘鑰
[[email protected] logs]# 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 public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
6b:45:21:25:cf:b2:0d:ac:cd:28:d6:1a:a2:32:82:41 [email protected]
The key‘s randomart image is:
+--[ RSA 2048]----+
| o.o |
| . = . |
| E + + |
|. . + + S o |
|.o o + o |
|* . o |
|o. . |
| |
+-----------------+
2、22號端口把秘鑰發過去
[[email protected] logs]# ssh-copy-id -i ~/.ssh/id_rsa.pub [email protected]
[email protected] password:
3、非22號端口把秘鑰發過去
[[email protected]
[email protected] password:
下次鏈接不用收入密碼了!
ssh22端口和非22端口建立秘鑰的使用方法