Lost root access possibility /sbin/nologin

Baltazor asked:

I accidentally edited the file /etc/passwd on my server in the following way:

root:x:0:0:root:/root:/sbin/nologin

Now I can not login as root. When I enter the su command, Cannot execute /sbin/nologin: No such file or directory is displayed in console.

I have not physical access to server. I have not users in sudoers file.

OS: Linux 2.6.24-23-server

Can you please help me to login as root?

My answer:


Boot the system from a Live CD, from which you can mount the filesystem and edit the etc/passwd file.


View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.