DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Add Existing User To New Group

  • submit to reddit
$ sudo groupadd <newgroup>
$ sudo usermod -a -G <newgroup> <username>
The -G option specifies that you want the user to be added to this <i>secondary</i> group.  Odds are, they are in more than one group already and you don't want to bump them out of their <i>primary</i> group.  

You can then run the following command to see that the user was added succesfully: 
$ id <username>

<a href="">Reference</a>