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.

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
What is output of sudo adduser shantanu? –  Pandya Jul 15 at 12:44
possible duplicate of How to recover root user –  Warren Hill Jul 15 at 12:49
@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
show 1 more comment

1 Answer 1

Finally I solved it using gnome-system-tools

enter image description here

share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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