Home » Questions » Computers [ Ask a new question ]

How can I log into Ubuntu-9.04 as administrator or root?

How can I log into Ubuntu-9.04 as administrator or root?

My problem is that whenever I try using sudo, I get an error message saying: shawn is not in the sudoers file. This incident will be reported. How can I add my user to the sudoers file? Or how can I log in as a user that is in the sudoers file?

Asked by: Guest | Views: 292
Total answers/comments: 2
Guest [Entry]

"Ubuntu locks the root password by default, so you cannot login as root or su into it. Normally your userid would belong to the admin group and the admin group has sudo permissions granted via /etc/sudoers.

Find out which id you're logged in as using the id command. This is obviously the wrong ""shawn"" id as you don't have sudo permissions.

Now, reboot the system. At the GRUB screen, press Esc to boot into recovery mode. In recovery mode, you are root. Delete the unwanted id (userdel) or just modify it to a different name (usermod). Reboot. You should be able to log into the correct id now (id command should show a different uid). If this doesn't work, just reboot again into recovery mode. Delete the other id too. Create a new id and add it to the admin group.

Edit: I just realized that SU had a very similar question in the sidebar, and following that led me to this answer that has a meticulously detailed write-up on booting into recovery mode (and editing the /etc/sudoers file)."
Guest [Entry]

"If you want to directly allow root logins, you first need to solve the problem of getting root access in the first place. Jeremy's answer above covers that.

Once you can run sudo commands, set the root password: sudo passwd. Now you will be able to login as root."