Languages
[Edit]
EN

Bash - add user to exiting group in Linux

2 points
Created by:
Root-ssh
75700

In this short article we want to show how in Linux, add user to exiting group using Bash (or any Command Line).

Quick solution:

sudo usermod -a -G group_name user_name

What will cause the user_name user will have attached additional group_name group.

Note:

  • in Linux each user is assignet to main group and additional groups,
  • run usermod command as super user.

Where:

  • -a means add operation,
  • -G means additional group.

Practical example

Type following command:

usermod -a -G sudo john

Testing:

root@debian# groups john
john : john sudo

Note: we can see now john is assigned to sudo group too.

Native Advertising
­čÜÇ
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - friendly IT community for everyone.

ÔŁĄ´ŞĆ­čĺ╗ ­čÖé

Join