How to add user to a Group in Linux
Add user to a Group
usermod - modify user accountA 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:
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
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