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 have tried to set up SFTP on a Debian machine, and was following instructions (and here) to prevent SFTP users from using remote login too.

But in doing so, it seems like I have locked root out from remote login too. Of course, without remote login, it seems like I am unable to fix this. It doesn't look like telnet is enabled. My other, ftp only, users are chrooted.

Is there any way to fix this? I guess if I were able to restore my sshd_config file (backed up as /etc/ssh/sshd_config.bak), I may able to log in again, but how to gain access?

As you can tell from the nature of the question, I am a bit of a newbie at all this....

share|improve this question

1 Answer 1

up vote 3 down vote accepted

Log in with your normal user account (the one for yourself, that you didn't put in a chroot) and su to root, then you can fix the problem.

If you somehow managed to chroot your own user account, or never created one in the first place (don't ever repeat this mistake) then you will have to get on the console, reboot to single user mode and recover it from the console.

share|improve this answer
    
Thanks for your reply. I'm afraid I don't have a normal user account, I usually just ssh in as root. So I just have root, and chrooted ftp accounts. –  tarling Mar 19 '13 at 20:51
4  
That's terribly bad practice; you should stop doing that now. –  Michael Hampton Mar 19 '13 at 20:53
    
@tarling: Michael is right. It sounds like getting locked out is about the best thing that could happen. Root login should never be permitted via ssh. It's a downright shame that this is the shipped configuration in most systems. –  Scott Pack Mar 19 '13 at 20:56

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.