Add user to group in Ubuntu

This simple tutorial will show you how to add a user to group in Ubuntu.In Unix or Linux system groups are used to share files between a small number of users.Same as Windows ,new groups will not take effect on your current logged in sessions,you need to log out then log in to enable your new groups.

 

In Ubuntu ,you can use command usermod or script adduser to add  users to group.

sudo adduser <username> <groupname>

OR

sudo useradd -a -G <groupname> <username>

For example,bellow command add user tom to sudo group

sudo adduser tom sudo

You can use command groups to verify this change

groups username

To remove user from a group,just use below command:

sudo deluser username groupname

One thought on “Add user to group in Ubuntu

  1. Pingback: Add user to group in Ubuntu

Leave a Reply

Your email address will not be published. Required fields are marked *