Super User is a question and answer site for computer enthusiasts and power users. 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

I accidentally modified the line for root in /etc/passwd and changed its named. To fix it I tried using sudo to modify this file, but it does not let me sudo because sudo can't find the root user since I renamed it.

II am on ubuntu.

share|improve this question
up vote 6 down vote accepted

Try :

sudo -u new_wrong_root_user

If you can't, reboot on a live-cd, then in terminal :

mkdir target
mount /dev/sda1 target # sda1 if / is the first partition of the first drive
vim target/etc/passwd
share|improve this answer
sudo -u worked. – aafc Dec 11 '12 at 21:15

If @sputnick's answer does not work, another solution would be to boot a live disc and mounting your drive in that, then use the live root user to adjust it.

share|improve this answer
sputnick does mention that possibility (perhaps a grace period edit), so this answer doesn't really make a lot of sense... – Michael Kjörling Oct 17 '14 at 8:32

You must log in to answer this question.

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