Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

2 Answers

up vote 5 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
add comment

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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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