EN
Bash - add user to exiting group in Linux
2
points
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 tosudo
group too.