Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 installed Ubuntu Linux 12.04 a little while ago to try it out and play around with it (hence I have no idea what I'm doing). I tried changing my home directory by editing the /etc/passwd file, however I must have put in a bad value as I can no longer login to my account. Whenever I try it boots me out to the login screen before I can make it to the desktop. The only other account is guest (I hadn't gotten around to disabling it yet), and I can login to that just fine.

Since I know which file I screwed up, I can edit it back to what it was and hopefully login again. However, since this is a system file, it requires sudo access to modify, which I don't have as a guest. Is there any workaround where I can somehow get sudo access as guest so I can edit this file and login as myself again? Obviously I don't intend to leave that ability on guest, that would be silly.

I remember reading somewhere that I could ssh to localhost as a user with sudo privileges, however I keep getting "connection refused". I believe it needs to be installed, and I hadn't gotten to that, and I can't do it now without sudo anyways...

I did install Linux alongside Windows 7, so if there's some way to edit it via Windows, I could do that (though from my understanding Windows can't read the file system).

share|improve this question
Are there any other users on the system with sudo or root rights? Alternatively, can you boot in single user mode to fix it ? – Hennes Sep 7 '13 at 23:24
Oh wow, I was able to boot into single user mode (never heard of that before) and got root access. I just did vi /etc/passwd and changed the file back to what it should be. Restarted and could login. Worked like a charm. – Doug Sep 7 '13 at 23:40
Another nice command to lean is vipw (It does sanity checks, preventing some typos from locking you or any other user out). – Hennes Sep 7 '13 at 23:46

You can use single user mode or append init=/bin/bash to your boot entry to login to a root shell

share|improve this answer

ctrl+alt+F1 and start TTY > login with your account and use sudo privileges

here is one example

share|improve this answer

You can boot from the live-cd and chroot into your installation and then change the password. Instructions to do so can be found here.

share|improve this answer

Your Answer


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.