Tuesday, March 27, 2018

How to add user to a Group in Linux

Add user to a Group

usermod - modify user account

A user does not belong to a specific group could cause application problem.

To check a user's existing group:
$ id user_name
To add an existing user to a group:
# usermod -aG group-name user-name

For example, to add user ec2-user to docker group:

$ sudo usermod -aG docker ec2-user

You need to logout and login to see the effect.

Be careful not to use

# usermod -g group-name user-name

It will change the user's primary group, instead of just adding to the group.

See also: How to remove user from a group in linux

Featured Post

British-based startup ARC unveiled its first motorcycle model in Milan this week

One being described as fast, advanced and expensive. The so-called Vector costs more than $100,000