0

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?

0

2 Answers 2

0

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

0

or via grub, add to the end of the kernel line:

init=/bin/bash

That should do it too. You may need to mount the filesystem read-write before the edit:

mount -o rw,remount /

Not the answer you're looking for? Browse other questions tagged .