Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've set up an linux server (32 bit), and would like to be able to ssh in as root based on RSA or DSA key trust. I've appended both public keys to ~/.ssh/authorized_keys and restarted the service; I am still prompted for a password. How do I enable key-based trust for ssh here?

share|improve this question
~/.ssh/* are all mode 600. – Jonathan Hayward Feb 24 '12 at 15:15
Restarting sshd is not necessary when adding new keys to a server. – EEAA Feb 24 '12 at 15:26
Beginner questions regarding Linux should be aimed at Unix & Linux unless they have a strong System Administrator angle. – Chris S Feb 24 '12 at 15:40
The checklist provided in @ErikA's answer I had all done. This isn't "I'm a beginner; what do I need to do to get this working;" it's "Why are the standard steps not working?" – Jonathan Hayward Feb 24 '12 at 18:59
Add a -v to your ssh connect command and post the output. In particular we need to see the bits where key negotiation is happening. – Zoredache Feb 25 '12 at 1:07
  1. ~/.ssh should be owned by the user and mode 700.
  2. ~/.ssh/* should be owned by the user and mode 600.
  3. Each public key should occupy one and only one line of the authorized_keys file.
  4. RSAAuthentication yes should be in your sshd_config.
share|improve this answer
I had all of these in place before asking; is there anything else? – Jonathan Hayward Feb 24 '12 at 17:03
Check what gets logged both by the client ($ ssh -vvv user@host) and by the server ( in /var/log/auth.log) when the user tries to connect with a key. – EEAA Feb 24 '12 at 19:01

Check to make sure following is true in the case of your SSHD server

PubkeyAuthentication yes
AuthorizedKeysFile  %h/.ssh/authorized_keys

Sometimes AuthorizedKeysFile switch is directed towards authorized_keys2 file

Then add your public keys under your

/your/home/.ssh/authorized_keys or /your/home/.ssh/authorized_keys2 depending on your configuration.

Yes and finally chmod authorized keys to 600.

**Please also check on "ErikA"'s answer

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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