How to add and delete users on Debian linux? Easy tutorial

Published in , ,

On

Managing users is one of the most common system administration tasks in Debian Linux. Whether you are creating a new account for another person, giving server access to a developer, or removing unused accounts, Debian provides simple command-line tools to handle everything efficiently. Debian mainly uses the adduser and deluser utilities for user management. These are considered more user-friendly front ends compared to lower-level commands like useradd and userdel.

If you want to learn complete user management including groups, passwords, and account permissions, read our detailed guide on creating and managing users on Debian linux.

For beginner-friendly tutorial continue reading…

Users

How to add a new user in Debian linux?

To create a new user account, run:

sudo adduser username

Example:

sudo adduser atul

After running the command, Debian will:

  • Create the user account.
  • Create a home directory.
  • Assign a default shell.
  • Ask you to set a password.
  • Optionally ask for additional information.

The adduser command also copies default configuration files from /etc/skel into the new user’s home directory.

Grant sudo access to a user.

If you want the user to perform administrative tasks, add them to the sudo group:

sudo usermod -aG sudo username

Example:

sudo usermod -aG sudo atul

You can verify the groups assigned to a user with:

id username

Example:

id atul

How to delete a user in Debian linux?

To remove a user account without deleting its files:

sudo deluser username

Example:

sudo deluser atul

By default, Debian removes the account but keeps the user’s home directory and files intact.

Delete a user along with home directory.

If you also want to remove the user’s home folder and mail spool, use:

sudo deluser --remove-home username

Example:

sudo deluser --remove-home atul

This is useful when permanently removing unused accounts from a server.

Remove all files owned by a user.

Debian also provides an option to remove all files owned by a user across the system:

sudo deluser --remove-all-files username

Be careful with this command because it may delete files outside the user’s home directory.

Difference between adduser and useradd.

Many Linux tutorials mention both adduser and useradd, which often confuses beginners.

  • adduser is interactive and beginner-friendly.
  • useradd is a lower-level utility with manual configuration.
  • Debian officially recommends adduser for most administrative tasks.

For everyday Debian administration, adduser and deluser are usually the best choices. This same guide will also work on all the Debian-based distributions.

Conclusion.

Debian makes user management simple with the adduser and deluser commands. You can quickly create accounts, assign sudo privileges, and safely remove users when no longer needed. Understanding these basics is essential for anyone managing a Debian server or desktop system.

For a more detailed guide covering password management, groups, account locking, and advanced administration tasks, read:

Further reading:

Leave a Reply

Your email address will not be published. Required fields are marked *