Root user can't use a key in Ubuntu 8.04?

I've set up my admin user to log in using the public/private key method, but for some reason, when I do the same with my root user, it doesn't work. Anybody know why?

In sshd_config, relevant code:

RSAAuthentication yes
PubkeyAuthentication yes
# AuthorizedKeysFile    %h/.ssh/authorized_keys
PermitRootLogin yes
AllowUsers pshields root

Then I saved the public key in /root/.ssh/authorized_keys

However, though my admin login works, the root login denies my key. Any ideas why?

3 Replies

1. Uncomment the AuthorizedKeyFile line.

AuthorizedKeysFile   %h/.ssh/authorized_keys 

2. Restart SSH.

/etc/init.d/ssh restart

See if this works…..

Also, check the permissions on the .ssh directory and the authorized_keys file. If they aren't correct, ssh will reject the key.

For security purposes, you should either use sudo, or su - to go to root, but only after you've logged it from a limited user account.


Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct