How to create a user and add them to a group in Ubuntu?
To create a user and add them to a group in Ubuntu, follow these steps:
- Open the terminal and login with root privileges. You can use the following command to switch to the root user:
sudo -i
- The user named
adduser <username>
You will be asked to create a password and provide some user information.
- What is the name of the group?
- Can you rephrase the following sentence in English, using your own words,
?
usermod -aG <groupname> <username>
Please make sure to use the “-aG” parameter instead of “-g” to add users to a group rather than replace the group.
- Repeat step 3 to add the user to another group (if necessary).
- Exit the root user.
exit
You have now successfully created a user and added them to the group. You can now log in to Ubuntu using the newly created user.