我無法在距離我的服務器到另一個連接,並且可以不明白爲什麼...調試SSH共享密鑰
[email protected]:~/.ssh$ ssh -vvv [email protected]
OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to 192.168.0.39 [192.168.0.39] port 22.
debug1: Connection established.
debug3: Incorrect RSA1 identifier
debug3: Could not load "/home/romain/.ssh/id_rsa" as a RSA1 public key
這奇怪的是我,因爲我有
[email protected]: cd /home/romain/.ssh/
[email protected]:~/.ssh$ ls -la
total 28
drwx------ 2 romain romain 4096 Feb 12 18:51 .
drwxr-xr-x 6 romain romain 4096 Feb 12 18:51 ..
-rw-rw-r-- 1 romain romain 400 Feb 11 18:46 authorized_keys
-rw------- 1 romain romain 137 Feb 11 18:46 environment
-rw------- 1 romain romain 1766 Feb 11 18:46 id_rsa
-rw-r--r-- 1 romain romain 400 Feb 11 18:44 id_rsa.pub
-rw-r--r-- 1 romain romain 222 Feb 11 18:44 known_hosts
是[「無法加載」/home/romain/.ssh/id_rsa「作爲RSA1公鑰」]引用本地服務器上的文件或遠程服務器上的文件?
編輯
服務器日誌:
Feb 12 19:45:17 pl sshd[28579]: debug1: temporarily_use_uid: 1000/1000 (e=0/0)
Feb 12 19:45:17 pl sshd[28579]: debug1: trying public key file /home/romain/.ssh/authorized_keys
Feb 12 19:45:17 pl sshd[28579]: debug1: fd 4 clearing O_NONBLOCK
Feb 12 19:45:17 pl sshd[28579]: Authentication refused: bad ownership or modes for directory /home/romain
目錄詳細信息:
[email protected]:/home$ cd /home/
[email protected]:/home$ ls -l
total 8
drwxrwxrwx 21 romain romain 4096 Feb 12 19:42 romain
drwxr-xr-x 7 root root 4096 Feb 10 18:32 users
羅曼的ID:
[email protected]:/home$ id -u romain
1000
登錄背景:
[email protected]:/var/log$ cat /var/log/auth.log | grep refused -C 10
Feb 12 19:45:17 pl sshd[28579]: debug3: mm_key_allowed: waiting for MONITOR_ANS_KEYALLOWED [preauth]
Feb 12 19:45:17 pl sshd[28579]: debug3: mm_request_receive_expect entering: type 23 [preauth]
Feb 12 19:45:17 pl sshd[28579]: debug3: mm_request_receive entering [preauth]
Feb 12 19:45:17 pl sshd[28579]: debug3: mm_request_receive entering
Feb 12 19:45:17 pl sshd[28579]: debug3: monitor_read: checking request 22
Feb 12 19:45:17 pl sshd[28579]: debug3: mm_answer_keyallowed entering
Feb 12 19:45:17 pl sshd[28579]: debug3: mm_answer_keyallowed: key_from_blob: 0x55f3e1d864b0
Feb 12 19:45:17 pl sshd[28579]: debug1: temporarily_use_uid: 1000/1000 (e=0/0)
Feb 12 19:45:17 pl sshd[28579]: debug1: trying public key file /home/romain/.ssh/authorized_keys
Feb 12 19:45:17 pl sshd[28579]: debug1: fd 4 clearing O_NONBLOCK
Feb 12 19:45:17 pl sshd[28579]: Authentication refused: bad ownership or modes for directory /home/romain
Feb 12 19:45:17 pl sshd[28579]: debug1: restore_uid: 0/0
Feb 12 19:45:17 pl sshd[28579]: debug1: temporarily_use_uid: 1000/1000 (e=0/0)
Feb 12 19:45:17 pl sshd[28579]: debug1: trying public key file /home/romain/.ssh/authorized_keys2
Feb 12 19:45:17 pl sshd[28579]: debug1: Could not open authorized keys '/home/romain/.ssh/authorized_keys2': No such file or directory
Feb 12 19:45:17 pl sshd[28579]: debug1: restore_uid: 0/0
Feb 12 19:45:17 pl sshd[28579]: Failed publickey for romain from 192.168.0.38 port 46259 ssh2: RSA 70:79:60:2c:96:12:05:17:b2:2e:a3:64:fe:38:45:8b
Feb 12 19:45:17 pl sshd[28579]: debug3: mm_answer_keyallowed: key 0x55f3e1d864b0 is not allowed
Feb 12 19:45:17 pl sshd[28579]: debug3: mm_request_send entering: type 23
Feb 12 19:45:17 pl sshd[28579]: debug2: userauth_pubkey: authenticated 0 pkalg ssh-rsa [preauth]
Feb 12 19:45:17 pl sshd[28579]: debug3: userauth_finish: failure partial=0 next methods="publickey,password" [preauth]
消息「無法加載」/home/romain/.ssh/id_rsa「作爲RSA1公鑰」只是噪聲。如果您進一步查看日誌,則會看到該密鑰已成功加載並使用。你從客戶端和服務器上得到的實際錯誤是什麼? – Jakuje
這裏的日誌位於客戶端。我怎麼能從服務器獲取錯誤日誌? –
使用syslog將錯誤記錄在服務器上。實際文件在哪裏取決於分發。如果日誌中沒有足夠的數據,可以嘗試在'sshd_config'中設置'LogLevel DEBUG3',重新啓動服務器,然後嘗試連接。會有很多消息,但他們會告訴你爲什麼被拒絕的關鍵。 – Jakuje