Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

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

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.


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

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

This question was marked as an exact duplicate of an existing question.

What is output of sudo adduser shantanu? – Pandya Jul 15 '14 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 '14 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 '14 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 '14 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 '14 at 13:31

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.