2011-06-27 50 views
0

我跟隨 SSH Git without having to type in my password every time爲什麼在將密鑰添加到authorize_key後,每次ssh到服務器時都要輸入密碼?

但現在我仍然必須每次輸入密碼。

[[email protected] .ssh]# pwd 
/home/git/.ssh 

[[email protected] .ssh]# /etc/init.d/sshd restart 
Stopping sshd:            [ OK ] 
Starting sshd:            [ OK ] 
------------ 

caojinhuamatoMacBook-Pro:.ssh caojinhua$ ssh -p 2332 [email protected] 
The authenticity of host '[xx.xx.xx.xxx]:2332 ([xx.xx.xx.xxx]:2332)' can't be established. 
RSA key fingerprint is 9b:e6:97:b1:a7:22:bd:b3:20:57:f3:0b:01:4e:b7:eb. 
Are you sure you want to continue connecting (yes/no)? yes 
Warning: Permanently added '[xx.xx.xx.xxx]:2332' (RSA) to the list of known hosts. 
[email protected]'s password: 
Last login: Mon Jun 27 11:00:16 2011 from 121.x8.23x.1x3 
[[email protected] ~]$ 
+0

你把你的公鑰ssh密鑰放在了authorized_keys文件中嗎? – jeremiah

回答

1

你應該確保爲~/.ssh/authorized_keys的權限是600

+0

我甚至讓它700 – qichunren

0

要麼你沒有正確添加關鍵,關鍵是在錯誤的格式,你有一個權限問題,或SSH配置在主機上只允許密碼驗證。

在四種可能性中,第二種是最有可能的。例如,如果您將SSH.com格式的密鑰剪切並粘貼到authorized_keys中,它將不起作用。您必須先將其轉換爲OpenSSH格式。

您的公鑰在authorized_keys中的外觀如何? (發佈它並沒有什麼壞處 - 畢竟它是公鑰)

+0

好吧,這看起來像一個openssh鍵。接下來的事情是嘗試與ssh -v連接,看看它說的是什麼問題。 – wadesworld

相關問題