This article covers how you can add and remove users on Ubuntu and assign them administrator privileges. Based on your convenience, you can either choose to add and remove users either through the command line or GUI.
Ubuntu, like any other Linux distribution, is a multi-user operating system. Each user can have different permission levels and specific settings for various command-line and GUI applications.
Knowing how to add and remove users is one of the basic skills a Linux user should know.
To add a user in Ubuntu via GUI:
1. Open the Activities overview and start typing Users.
2. Click on Users to open the panel.
3. Press Unlock in the top right corner and type in your password when prompted.
4. Press the + button, below the list of accounts on the left, to add a new user account.
To remove a user from Ubuntu:
1. Open the terminal app.
2. Login to server using the ssh user@server-ip-here command.
3. Run sudo deluser --remove-home userNameHere command to delete a user account on Ubuntu.
4. Verify it by running id command.
To Remove a Linux user:
1. Log in to your server via SSH.
2. Switch to the root user: sudo su -
3. Use the userdel command to remove the old user: userdel user's username.
Optional: You can also delete that user's home directory and mail spool by using the -r flag with the command: userdel -r user's username.
To Add a User to Linux:
1. Log in as root.
2. Use the command useradd "name of the user" (for example, useradd linuxapt)
3. Use su plus the name of the user you just added to log on.
4. "Exit" will log you out.
Linux operations commands:
1. adduser : add a user to the system.
2. userdel : delete a user account and related files.
3. addgroup : add a group to the system.
4. delgroup : remove a group from the system.
5. usermod : modify a user account.
6. chage : change user password expiry information.
How do I assign a user to a group in Linux?
1. To create a new group, enter the following: sudo groupadd new_group.
2. Use the adduser command to add a user to a group: sudo adduser user_name new_group.
3. To delete a group, use the command: sudo groupdel new_group.
4. Linux comes with several different groups by default.