Thursday, January 21, 2016

Root locked out of SSH



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....


Answer



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.


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...