2012-04-07 139 views
1

我ssh-ing從server1server2。我生成了id_rsa & id_rsa.pub文件。如果我ssh到麥克@ server2它工作正常,但ssh到約翰@ server2不工作沒有密碼。兩個麥克& john主目錄包含「.ssh」,它是chmod 700,該文件夾包含「authorized_keys」,其中只包含之前生成的id_rsa.pub文件(並且是chmod 600)的內容。兩者的內容都是一樣的。麻煩ssh和authorized_keys

服務器1:Linux的x86_64的x86_64的x86_64的GNU/Linux的

服務器2:AIX 5.3.0.0 64位

命令1,用戶邁克(可與無密碼): ssh -v -n -o StrictHostKeychecking=no -o NumberOfPasswordPrompts=0 [email protected] echo Hello

drwx------ 7 mike mike 4096 Jan 19 2011 .

的〜/ .ssh drwx------ 2 mike mike 256 Nov 28 16:39 .ssh

的〜/ .ssh /作者ized_keys -rw------- 1 mike mike 823 Apr 06 11:56 .ssh/authorized_keys


命令2,用戶約翰(需要密碼) ssh -v -n -o StrictHostKeychecking=no -o NumberOfPasswordPrompts=0 [email protected] echo Hello

drwx------ 12 john jgroup 4096 Apr 06 23:13 .

的〜/ .ssh drwx------ 2 john jgroup 256 Apr 06 23:56 .ssh

的〜/ .ssh/authorized_keys中-rw------- 1 john jgroup 414 Apr 06 11:55 .ssh/authorized_keys

ssh -v從上面輸出命令2:

OpenSSH_4.3p2, OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008 
debug1: Reading configuration data /etc/ssh/ssh_config 
debug1: Applying options for * 
debug1: Connecting to server2 [X.X.X.X] port 22. 
debug1: Connection established. 
debug1: identity file /home/will/.ssh/identity type -1 
debug1: identity file /home/will/.ssh/id_rsa type 1 
debug1: identity file /home/will/.ssh/id_dsa type -1 
debug1: loaded 3 keys 
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.0 
debug1: match: OpenSSH_5.0 pat OpenSSH* 
debug1: Enabling compatibility mode for protocol 2.0 
debug1: Local version string SSH-2.0-OpenSSH_4.3 
debug1: SSH2_MSG_KEXINIT sent 
debug1: SSH2_MSG_KEXINIT received 
debug1: kex: server->client aes128-cbc hmac-md5 none 
debug1: kex: client->server aes128-cbc hmac-md5 none 
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent 
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP 
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent 
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY 
debug1: Host 'server2' is known and matches the RSA host key. 
debug1: Found key in /home/will/.ssh/known_hosts:838 
debug1: ssh_rsa_verify: signature correct 
debug1: SSH2_MSG_NEWKEYS sent 
debug1: expecting SSH2_MSG_NEWKEYS 
debug1: SSH2_MSG_NEWKEYS received 
debug1: SSH2_MSG_SERVICE_REQUEST sent 
debug1: SSH2_MSG_SERVICE_ACCEPT received 

This network/computer system is for the use of authori... 
......................................................... 

debug1: Authentications that can continue: publickey,password,keyboard-interactive 
debug1: Next authentication method: publickey 
debug1: Trying private key: /home/will/.ssh/identity 
debug1: Offering public key: /home/will/.ssh/id_rsa 
debug1: Authentications that can continue: publickey,password,keyboard-interactive 
debug1: Trying private key: /home/will/.ssh/id_dsa 
debug1: Next authentication method: keyboard-interactive 
debug1: Next authentication method: password 
debug1: No more authentication methods to try. 
Permission denied (publickey,password,keyboard-interactive). 

任何人都有的,爲什麼它會與一個用戶工作思路,而不是另一個(兩者是在同一臺服務器上)?

回答

2

失敗的常見原因有鑰匙進行身份驗證:

  • 權限或所有權上的〜/ .ssh設置不正確(我看你已經檢查了這些)
  • 公鑰已損壞
  • 公鑰是用於與私鑰不同的密鑰

還檢查服務器的auth.log

+0

如果公鑰/私鑰出現問題,是否會影響與其他ID的連接? – askmike1 2012-04-07 04:57:31

+0

注意「公鑰是用於與私鑰不同的密鑰」。從文件大小來看,我猜你在第一個賬戶的authorized_keys中有另一個密鑰。也許那個其他的密鑰實際上是你在ssh時使用的密鑰? – 2012-04-07 07:12:33

+0

我從mike的authorized_keys中刪除了另一個密鑰,它仍然與該用戶一起工作。 – askmike1 2012-04-07 11:34:36

0

你能夠登錄,因爲邁克是一個真正的擊球手。您可以嘗試製作一個authorized_keys2文件。 authorized_keys不適用於所有版本的OpenSSH。

ln -s authorized_keys authorized_keys2