How to add user to a group?

To add a user to a group in Linux, you can use the usermod command. Here’s how to do it:

  1. Open a terminal.

  2. Run the following command (replace username with the user's name and groupname with the name of the group):

    sudo usermod -aG groupname username
    
    • -aG: This option appends the user to the specified group without removing them from other groups.
  3. Verify the change by checking the groups the user belongs to:

    groups username
    

This will list all groups that the user is a member of, including the newly added group. If you have any more questions, feel free to ask!

0 Comments

no data
Be the first to share your comment!