Tuxtips - Linux HowTos

Linux HowTos live here


How to add a user to an existing group in Linux

10 Jul 2020

This is one of the commands that you will probably not run very often, unless you install Linux systems regularly and want to enable a user (e.g. yourself) to perform certain actions.

The command is very simple (run it as root, otherwise put sudo in front of the command):
click code to copy
usermod -a -G group user
where group is the name of the group and user is the name of the user, obviously. Note: in Debian you might need to give the full path to the usermod command:
click code to copy
/usr/sbin/usermod -a -G group user
So, for example, if your username is geek and you want to add yourself to the sudo group, the command will look like this:
click code to copy
usermod -a -G sudo geek
Of course for the permissions to work you sometimes need to log out and log back in.
Tested on: Arch, July 2020 & Debian, Feb. 2021
Comments Add your comment




Enter the digit "six" (spam protection):