I have an RSA public/private keypair on my laptop; on a remote machine I have two accounts A and B which each have the public key in /home/{A,B}/.ssh/authorized_keys. With the private key loaded in ssh-agent on my laptop, I can ssh to A@remote without a password, but B@remote prompts for a password.

I have no ~/.ssh/ssh_config on my laptop. User A has no password yet; B does. Switching /etc/ssh/ssdh_config to "PasswordAuthentication no" just results in "ssh publickey denied" for user B.

The server is on Ubuntu 9.10 Karmic, with OpenSSH_5.1p1 Debian-6ubuntu2, OpenSSL 0.9.8g 19 Oct 2007. Laptop is Ubuntu 10.04 with OpenSSH_5.3p1.

  • 1
    What are the permissions and ownership of the authorized_keys files, and of their parent directories? Does sudo sshd -rddp 222 on the remote machine show anything? (Connect to port 222.) – user1686 Feb 2 '11 at 20:38

It turned out the broken user's $HOME/.ssh folder had the "write" permission enabled for group. chmod go-rwx $HOME/.ssh fixed the issue.


In my case, in addition to permissions to the .ssh/authorized_keys file (s. answer by @tobym), the problem cause was a locked account.

Debugging on the server with sudo tail -f /var/log/auth.log showed

User <account-name> not allowed because account is locked

Account was locked because I have not set any password since I wanted just passwordless, key-based authentication. Solution was to

sudo passwd <account-name>

and assign some random complex password.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.