![两台机器上的 ssh authorized_keys](https://linux22.com/image/1349726/%E4%B8%A4%E5%8F%B0%E6%9C%BA%E5%99%A8%E4%B8%8A%E7%9A%84%20ssh%20authorized_keys.png)
我有两台具有相同 .ssh/authorized_keys 的机器(已验证,因为 (1) 一台是另一台的副本,并且 (2) 两台机器上的文件的 md5sum 匹配)
和相同的 /etc/ssh/sshd_config(已验证,因为 (1) 一个是另一个的副本,并且 (2) md5sums 匹配)。
两台机器上都重新启动了 sshd。
一个可以工作(使用公钥方法,即我无需输入密码就可以登录),而另一个则不可以。
运行 ssh -vv 显示以下内容:
好机显示:
debug1: Offering DSA public key: /Users/xxx/.ssh/id_dsa
debug2: we sent a publickey packet, wait for reply
debug1: Server accepts key: pkalg ssh-dss blen 433
debug2: input_userauth_pk_ok:
debug1: read PEM private key done: type DSA
debug1: Authentication succeeded (publickey).
Authenticated to xxx.amazonaws.com ([xxx]:22).
debug1: channel 0: new [client-session]
debug2: channel 0: send open
debug1: Requesting [email protected]
debug1: Entering interactive session.
debug2: callback start
debug2: client_session2_setup: id 0
debug2: channel 0: request pty-req confirm 1
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
debug2: channel 0: request env confirm 0
debug2: channel 0: request shell confirm 1
debug2: fd 3 setting TCP_NODELAY
debug2: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug2: channel_input_status_confirm: type 99 id 0
debug2: PTY allocation request accepted on channel 0
debug2: channel 0: rcvd adjust 2097152
debug2: channel_input_status_confirm: type 99 id 0
debug2: shell request accepted on channel 0
坏机显示:
debug1: Offering DSA public key: /Users/xxx/.ssh/id_dsa
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,password
debug2: we did not send a packet, disable method
debug1: Next authentication method: password
有什么想法吗?
答案1
参见评论:“将 .ssh 更改为 700 并将 authorized_keys 更改为 600 有效。但为什么它在‘好机器’上运行良好?”