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.

This question already has an answer here:

I accidentally changed my primary group using the following command.

sudo usermod -g localgroup shantanu #shantanu is my username

I interrupted this process as soon as I realize what is happening. As a result sudo was working but pkexe was affected. So I tried to restore my primary group using the same command

sudo usermod -g shantanu shantanu

Then I reboot my system. Now i can't use sudo. So I open root shell (recovery) and run the following the command

usermod -G sudo shantanu

But when I log in back to my account and run groups command, sudo is not listed. Also i can't use sudo. Finally what i did, add my user in visudo but i don't want to do this.

How can I add my user into sudo group? Thanks in advance.

System:

ubuntu 14.04 64bit (up to date)
share|improve this question

marked as duplicate by Warren Hill, user68186, Eric Carvalho, Luis Jul 24 at 17:52

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.

    
What is output of sudo adduser shantanu? –  Pandya Jul 15 at 12:44
    
@Pandya shantanu is already my default user. Why should i run adduser?? Output: adduser: The user `shantanu' already exists. –  shantanu Jul 15 at 13:09
    
Were there any errors when you ran usermod -G sudo shantanu from the recovery console? Did you remember to remount the filesystem with read-write permissions first? FYI you should use -aG else it will remove you from all other secondary groups (or use gpasswd --add shantanu sudo instead - it's safer). –  steeldriver Jul 15 at 13:19
    
@steeldriver usermod returns no error. Yes i remount the filesystem. I also tried -aG option. I didn't gpasswd, is it really safe? My my current user is pretty important. I don't want to mess it up right now. –  shantanu Jul 15 at 13:28
    
@WarrenHill I describe the steps in my question in text. Theses steps didn't work for me. Everything is working except sudo. Also manually adding my user in visudo fix the sudo problem. But i just want know, why usermod is not working(add shantanu into sudo group) ? –  shantanu Jul 15 at 13:31

1 Answer 1

Finally I solved it using gnome-system-tools

enter image description here

share|improve this answer

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