Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

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


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?

share|improve this question

marked as duplicate by Michael Hampton, mdpc, Grant, James O'Gorman, Ward Apr 6 '13 at 4:10

This question was marked as an exact duplicate of an existing question.

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

share|improve this answer

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


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

mount -o rw,remount /
share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.