How to create users and groups in Ubuntu?

In Ubuntu, you can use the following commands to create users and groups:

  1. Create user.
sudo adduser username

Replace “username” in the command with the username you want to create. The system will prompt you to enter the password and other relevant information for the new user.

  1. Create a group:
sudo addgroup groupname

Replace “groupname” in the command with the name of the group you want to create.

  1. Add users to a group.
sudo adduser username groupname

Replace “username” in the command with the username of the person you want to add to the group, and replace “groupname” with the name of the group.

  1. Check users and groups.
groups username

Replace “username” in the command with the username you want to check. The system will display the groups that user belongs to.

groups

This command will list all groups that the current user belongs to.

Please note that the above command requires a user with sudo privileges to execute.

bannerAds