T.Louis
December 20th, 2009, 05:07 AM
Hello,
I received the message "Permission denied (public key)" recently when installing OpenSSH. I had set it up to use it without password but with a passphrase and private and public keys.
Now the message above in quotes is a common problem and can be resolved in many ways, and the most common solution is that people have forgotten to change the .ssh folder and id_xxx file rights to 700 and 600.
However, I stumbled upon another quirk:
When you are logged into your Ubuntu Server on user account and attempt to ssh in from a client with the same user name, the public/private key works great. But when you log out from your Ubuntu Server with the user name, and then try to connect with the client you get the message "Permission denied (public key)".
I honestly don't know why this is, if its the fact that the the home folder and .ssh folder on the server is encrypted when you log out or if its some quirk that I can't wrap my head around.
But the solution is to take your authorized_keys on your server out of the home directory and put them somewhere else, say in /etc/ssh and edit your sshd_config to reflect this with AuthorizedKeysFile /etc/ssh/authorized_keys and it seems to work.
Now I don't really know if this poses any security issues? If anyone has any comments on this, please do reply!
Thanks,
TL
I received the message "Permission denied (public key)" recently when installing OpenSSH. I had set it up to use it without password but with a passphrase and private and public keys.
Now the message above in quotes is a common problem and can be resolved in many ways, and the most common solution is that people have forgotten to change the .ssh folder and id_xxx file rights to 700 and 600.
However, I stumbled upon another quirk:
When you are logged into your Ubuntu Server on user account and attempt to ssh in from a client with the same user name, the public/private key works great. But when you log out from your Ubuntu Server with the user name, and then try to connect with the client you get the message "Permission denied (public key)".
I honestly don't know why this is, if its the fact that the the home folder and .ssh folder on the server is encrypted when you log out or if its some quirk that I can't wrap my head around.
But the solution is to take your authorized_keys on your server out of the home directory and put them somewhere else, say in /etc/ssh and edit your sshd_config to reflect this with AuthorizedKeysFile /etc/ssh/authorized_keys and it seems to work.
Now I don't really know if this poses any security issues? If anyone has any comments on this, please do reply!
Thanks,
TL