ssh配對密鑰認證問題

ssh配對密鑰認證問題

我在公鑰和私鑰身份驗證方面遇到問題。我執行了這些步驟,然後基於公鑰的方法不起作用。 1- 使用以下指令產生一對私鑰和公鑰 (RSA):

Generating public/private rsa key pair.
Enter file in which to save the key (/home/rc_ss/.ssh/id_rsa): 
Created directory '/home/rc_ss/.ssh'.
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/rc_ss/.ssh/id_rsa.
Your public key has been saved in /home/rc_ss/.ssh/id_rsa.pub.
The key fingerprint is:
ac:fd:d1:2e:e5:1e:db:87:98:77:9e:14:62:db:97:f0 rc_ss@rc_ss-network
The key's randomart image is:
+--[ RSA 2048]----+
|                 |
|                 |
|                 |
|       .         |
|        S    + . |
|       o   .o * o|
|      . . .oo+ E.|
|         ..o+++ =|
|          .o+..=.|
+-----------------+

2-使用 ssh-copy-id 透過網路複製它,如下

rc_ss@rc_ss-network:~$ ssh-copy-id -i .ssh/id_rsa.pub [email protected]
The authenticity of host '192.168.2.100 (192.168.2.100)' can't be established.
ECDSA key fingerprint is 33:67:e0:02:b1:10:46:76:78:6b:1f:e2:55:9b:6a:a8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.2.100' (ECDSA) to the list of known hosts.
[email protected]'s password: 
Now try logging into the machine, with "ssh '[email protected]'", and check in:

  ~/.ssh/authorized_keys

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

3-然後,我想在沒有密碼的情況下連接到伺服器ssh,並處理以下內容:

rc_ss@rc_ss-network:~$ ssh [email protected]
[email protected]'s password: 

這意味著還需要密碼。有誰能夠幫助我?欣賞它。

答案1

假設公鑰已正確複製到目標伺服器,您需要確保 SSH 守護程式支援無密碼登入。此配置在文件中設置/etc/ssh/sshd_config,您需要確保設置以下值:

PermitRootLogin yes
RSAAuthentication yes
PubkeyAuthentication yes

如果未設定這些值,您將需要設定它們,然後在sudo service ssh restart終端中重新啟動 SSH。

相關內容