Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm running debian 6.0.6, and I want to remotely login it as root without password.

I tried the typical ssh-login-without-password configuration (.ssh/authorized_keys), but it didn't work. So I doubt that there may be some place that restrict ssh as root without password.

Anyone knows where can I bypass this restriction?

share|improve this question
    
Why do you want to reduce the security of your system (There are good reasons - Do you have one?) -- You're generally better logging in as a regular unprivileged user and using sudo... –  voretaq7 Dec 12 '12 at 20:52
    
Running commands and scripts through ssh remotely would be a good reason, of course even for that there are ways around ssh'ing as root. I wonder though how much safer is a system that allows "ssh user@example.org sudo bash" as opposed to "ssh root@example.org". The only extra hurdle the former brings you is the questionable obscurity of which username has the sudo rights. But security through obscurity doesn't make something more secure. Using sudo and su has benefits wrt accountability. I think the more important issue is using passwordless key vs. password. –  aseq Dec 13 '12 at 2:18

3 Answers 3

/etc/ssh/sshd_config has a PermitRootLogin setting.

Note, however, that there's a good reason it defaults to no. Is there a reason you can't escalate with sudo?

share|improve this answer
    
The thing is, I do have a "yes" for PermitRootLogin, and I can actually ssh root@myserver with password. What I want is to ssh as root without password. I added to /root/.ssh/authorized_keys a public key, but it cannot allow me to login as root without password ... –  flyingbin Dec 12 '12 at 20:21
3  
@flyingbin, You generally shouldn't have a yes value, using PermitRootLogin without-password is the preferred compromise. If you have that value set, then try connecting with the verbose option -v for ssh. Then update your question with the output. –  Zoredache Dec 12 '12 at 20:43

Check permissions on your /root/.ssh (should be 0700) and /root/.ssh/authorized_keys (0600). Check logs for other messages that would indicate if something is going wrong.

share|improve this answer
    
Also check the ownership on these files/directories. Ssh WILL refuse to honour authorized_keys if anything is wrong with these in the slightest. BTW, sshd has no idea whether a publickey login uses a password protected key or not so there will not be an option for that. –  rackandboneman Dec 13 '12 at 15:00

If you can log in to the remote server interactively as root, maybe try using the script ssh-copy-id. It will attempt to write your public key to the correct place on the remote host. It'd already be there on a debian system.

ssh-copy-id [-i [identity_file]] [user@]machine
share|improve this answer

Your Answer

 
discard

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.