Possible Duplicate:
Regain Sudo rights after removing from admin group

I created a new user and changed the ssh config. I forgot to add root permission to the newly created user.

Now I need to undo my changes in ssh config. Is that possible without any sudo command?

marked as duplicate by Oli Aug 24 '12 at 22:18

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


No. Can't you log in as the admin user (who was created at installation time)? If yes, log in and add the new user to the sudo group, where's the problem?

If no, do you have physical access to the machine? If yes, boot from a Ubuntu CD, mount your harddrive and add the user to the group manually. For example, assuming that /dev/sdb1 is the partition on your hard drive that is mounted as root (/), then after booting the live CD, do:

sudo -i
mount /dev/sdb1 /mnt
cd /mnt/etc
nano group

(yeah, you can do that all from a GUI as well)

A simple text editor opens. Search for the line starting with "sudo". It may look something like this:


Assuming that oldadmin is the user name of the admin. If the new user's login name is newuser, modify that line to


save the file and reboot the computer. The newuser should have now the privilege to run sudo.

If you do not have physical access to the machine, you lost your administrative password and the root is not permitted to log in, then you have a problem, sir.

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