Ubuntu Linux: Add a User To Group

Ubuntu Linux: Add a User To Group

To add a user to a group on Ubuntu Linux, you can use the usermod command. Here's an example of how to use the usermod command to add a user to a group:

  1. First, make sure that the user you want to add to the group exists on your system. If the user does not exist, you can create it by running the following command:
sudo adduser <username>
So‮ww:ecru‬w.lautturi.com

Replace <username> with the desired username.

  1. Add the user to the group by running the following command:
sudo usermod -a -G <group> <username>

Replace <group> with the name of the group you want to add the user to, and <username> with the username of the user you want to add to the group.

  1. (Optional) If you want the changes to take effect immediately, you can log out and log back in, or you can use the newgrp command to switch to the group:
newgrp <group>

Replace <group> with the name of the group you want to switch to.

That's it! The user should now be a member of the group.

Keep in mind that adding a user to a group gives that user certain privileges or permissions associated with the group. It is important to be careful when adding users to groups and to limit access to trusted users only.

Created Time:2017-10-30 14:27:27  Author:lautturi