1

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?

EEAA
  • 109,363
  • 18
  • 175
  • 245
Christos Hayward
  • 1,162
  • 3
  • 16
  • 35

2 Answers2

0
  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.
EEAA
  • 109,363
  • 18
  • 175
  • 245
  • I had all of these in place before asking; is there anything else? – Christos Hayward Feb 24 '12 at 17:03
  • 1
    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
0

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

kaji
  • 2,528
  • 16
  • 17