Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question
add comment

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.

1 Answer

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:

sudo:x:27:oldadmin

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

sudo:x:27:oldadmin,newuser

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.

share|improve this answer
add comment

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