Add, Delete, and Update Accounts in Ubuntu from Terminal

Single user account on a shared computer can be a security issue? Using multiple user accounts in Ubuntu is a powerful way to improve both security and workflow organization. Separating work documents from personal files, restricting access to sensitive data for different users, and simplifying collaboration with colleagues. Most importantly, using a single root account for everyday tasks creates a significant security risk. Accidental data deletion or accidental compromised program installation with root privileges could have devastating consequences.

Adding new user

Set your username.


sudo adduser username


When adding new user you can just add the password and skip other requirements like complete name and address and other things if thats not necessary for you.

Removing user


sudo userdel username


Delete everything of the user including files


sudo userdel -r username


Grant the user sudo privilege ( user can install and and change everything)


sudo usermod -aG sudo username


To remove sudo privilege


sudo deluser username sudo


Update username of a user


sudo usermod -l newname previousname


Related Posts

How to run python file in terminal
July 3, 2024

Open the terminal from you script directory ( Go to the folder where your python script is or the script you want to run. [ after going to the folder, click right mouse button … you find open in terminal option]) and run python3 python_file_name.py Copy If you know your python file location you can […]

How to generate requirements.txt in python
March 10, 2024

A requirements.txt file is essential for managing Python project dependencies. It ensures everyone working on your project has the correct libraries installed for development and deployment. The simplest way or automatically generate requirements.txt is using piprequs library. It will generate requairements.txt file based on the imports of your project. First install the library pip install […]

How to add or remove a directory in ubuntu
March 3, 2024

Creating the directory mkdir directory_name Copy If the path is protected we need to use sudo command Removing the directory rmdir directory_name Copy If the path is protected we need to use sudo command Remove the directory including items permanently rm -r directory_name Copy More Make sure you understand the commands actions . Then run […]