UPDATE: I've solved this strange problem by simply restart sshd
. However, I'm still wondering why, because I didn't change any configs since the server started.
I have 2 servers, one installed CentOS 5 and the other is CentOS 6. ssh
publickey works fine on the CentOS 5 one, but it doesn't work on the CentOS 6. I confirmed the permissions of .ssh
directory, it's fine.
[root@localhost ~]# ls -Z .ssh/
drwxr-xr-x. root root unconfined_u:object_r:ssh_home_t:s0 .
dr-xr-x---. root root system_u:object_r:admin_home_t:s0 ..
-rw-r--r--. root root unconfined_u:object_r:ssh_home_t:s0 authorized_keys
-rw-------. root root unconfined_u:object_r:ssh_home_t:s0 id_rsa
-rw-r--r--. root root unconfined_u:object_r:ssh_home_t:s0 id_rsa.pub
-rw-r--r--. root root unconfined_u:object_r:ssh_home_t:s0 known_hosts
UPDATE: I've tried several permissions, including 600, 644 for authorized_keys
, and 700, 755 for .ssh/
, all of them don't work.
ssh -vvv
gives these message
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug3: start over, passed a different list publickey,gssapi-keyex,gssapi-with-mic,password
debug3: preferred publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/zuohaocheng/.ssh/id_rsa
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Trying private key: /Users/zuohaocheng/.ssh/id_dsa
debug3: no such identity: /Users/zuohaocheng/.ssh/id_dsa
debug2: we did not send a packet, disable method
debug3: authmethod_lookup password
debug3: remaining preferred: ,password
debug3: authmethod_is_enabled password
debug1: Next authentication method: password
Everything in sshd_config
is as default. Also, I copied publickey through ssh-copy-id
.