Digital Marketing

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.

Comments

Popular posts from this blog

MySQL Sandbox with the Sakila sample database