To add a user to a group in Linux, you can use the usermod command. Here’s how to do it:
Open a terminal.
Run the following command (replace
usernamewith the user's name andgroupnamewith 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.
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!
