I am having difficulties logging in to a VPS running CentOS 5.5 using Public key authentication. I can log in to both a standard user account and the root account using password authentication. I am using Windows and Cygwin, all Cygwin and Windows stuff has been working completely fine for months; I am sure the issue is server side.
I have used ssh-keygen to create both an id_rsa private key and an id_rsa.pub public key. I have copied this into the user directory on the server and done cat id_rsa.pub >> authorized_keys
. My /home/myuser/.ssh directory is set to 700, the authorized_keys file is set to 600.
When logging in my system reports the following (-vvv):
Next authentication method: publickey
Offering RSA public key /.ssh/id_rsa
send_pubkey_test
we sent a publickey packet, wait for reply
Authentications that can continue: publickey,password
Then asks me for a password. From my server's /var/log/auth file I have the following related to the public key process
sshd[28249]: input_userauth_request: try method publickey
sshd[28249]: test whether pkalg/pkblob are acceptable
sshd[28249]: mm_key_allowed entering
sshd[28249]: mm_request_send entering: type 21
sshd[28249]: mm_key_allowed: waiting for MONITOR_ANS_KEYALLOWED
sshd[28249]: mm_request_receive_expect entering: type 22
sshd[28248]: monitor_read: checking request 21
sshd[28249]: mm_request_receive entering
sshd[28248]: mm_answer_keyallowed entering
sshd[28248]: mm_answer_keyallowed: key_from_blob: 0x2b6ea1049910
sshd[28248]: temporarily_use_uid: 10022/10022 (e=0/0)
sshd[28248]: trying public key file /home/myuser/.ssh/authorized_keys
sshd[28248]: secure_filename: checking '/home/myuser/.ssh'
sshd[28248]: secure_filename: checking '/home/myuser'
sshd[28248]: secure_filename: terminating check at '/home/myuser'
sshd[28248]: restore_uid: 0/0
sshd[28248]: key not found
sshd[28248]: temporarily_use_uid: 10022/10022 (e=0/0)
sshd[28248]: trying public key file /home/myuser/.ssh/authorized_keys
sshd[28248]: secure_filename: checking '/home/myuser/.ssh'
sshd[28248]: secure_filename: checking '/home/myuser'
sshd[28248]: secure_filename: terminating check at '/home/myuser '
sshd[28248]: restore_uid: 0/0
sshd[28248]: key not found
sshd[28248]: Normalising mapped IPv4 in IPv6 address
sshd[28248]: Failed publickey for myuser from 87.115.220.187 port 59636 ssh2
As if it can't find the authorized_keys file. However the command nano /home/myuser/.ssh/authorized_keys
opens the file without issue.
From /etc/ssh/sshd_config:
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
Some people have reported that line breaks in the authorized_keys file can cause issues so I've made sure there are none (only 1 key in it anyway). The file begins with ssh-rsa
then has the long key and finally a space and M1ke@M1ke-PC
.
Anyone got any ideas?
myuser
directory is also set to700
. Can't remember if I did that or it was already that way.myuser
own all the relevant dirs and files on the server side?ls -ld /home/myuser/.ssh{,/authorized_keys}
. I suspect that perhaps the user doesn't own the directory and file?/var/log/secure
without any modification to the configuration.