How to set public SSH key for root user on server?

I'm trying to follow Slicehost Document to setup my server. I reached SSH section. I made it as written, but when i logged out from root, i cant access root@IP_ADDRESS -p 30000 again! but i can access user@IP_ADDRESS -p 30000.

So, the question is, how to set a public SSH key for root user?


Solution 1:

I'm not sure what you mean. You mean you can't login as root with your public_key? If so check /root/.ssh/authorized_keys

Have also look at /etc/ssh/sshd_config It should contain:

PermitRootLogin yes

Solution 2:

Have a look in the logs. sshd usually gives helpful messages. Try /var/log/auth.log or /var/log/messages or /var/log/syslog (or something else) depending on your platform.

Sounds like a permissions problem to me though. Try these commands (as root): chmod 700 ~root ~root/.ssh && chmod 600 ~root/.ssh/authorized_keys