We will discuss user management concepts such as creating a user, assigning permissions, and deleting a user in this section. Then, we will discuss file permissions for user and groups.
In this section, we will discuss how to add users, delete users, give them permissions, and more.
To add a new user to your Ubuntu Server, use the following command:
sudo adduser user2
You will be asked to enter some details apart from the username and password for the new user. To delete a user, use the following commands:
sudo deluser user2 sudo rm -r /home/user2
Pay attention here, this operation does not delete the home
directory of the user. Adding and deleting groups is similar to that of users. Here's the syntax to add and remove groups:
sudo addgroup groupname sudo delgroup groupname
Now, to add a user to a group, execute the following command:
sudo adduser user2 groupname