How To Create A New User On Debian 13 Trixie
Creating a new user on Debian 13 (Trixie) is an essential task for managing system access, improving security, and organizing responsibilities on a Linux server or workstation. Debian provides simple and reliable commands for adding users, assigning permissions, enabling sudo access, and configuring account settings. With just a few commands, you can create secure and well-structured user accounts tailored to your system's needs.
Here's a clear, step-by-step guide to create a new user on Debian 13 (Trixie). Copy-paste the commands into your terminal (replace username with the actual name you want).
1. Create A New User (Recommended)
Use adduser - it creates a home directory and prompts for a password and optional info.
sudo adduser usernamesudo adduser username
Replace username with the desired user name (lowercase, no spaces).
Example session :
$ sudo adduser alice
Adding user `alice'...
Enter new UNIX password: ********
Retype new UNIX password: ********
Full Name []: Alice Admin
Room Number []:
Work Phone []:
Home Phone []:
Other []:
Is the information correct? [Y/n] Y2. Give The User Sudo (optional)
To allow the user to run administrative commands with sudo, add them to the sudo group:
sudo usermod -aG sudo usernameVerify by running :
groups usernameTip : After adding to the sudo group, the user should log out and log back in for groups to refresh, or use newgrp sudo.
3. Switch to the new user
Use su - username to switch to the user account (preserves login environment) :
su - usernameTo test sudo as that user :
sudo whoamishould print : root
4. Create A User Without Password (system/service user)
Use this for service accounts that shouldn't allow interactive logins :
sudo adduser --disabled-password --gecos "" serviceuserThis creates the account but does not set a usable password.
5. Create a user without a home directory
sudo adduser --no-create-home --disabled-password svc_nohomeUseful for lightweight system accounts.
6. Change or set password later
sudo passwd usernameYou will be prompted to enter and confirm the new password.
7. Set default shell and home directory
To change a user's login shell:
sudo chsh -s /bin/bash usernameTo move or change home directory (advanced) :
sudo usermod -d /home/newdir -m usernameThe -m flag moves existing files to the new home.
8. Remove a user
Remove user but keep files :
sudo deluser usernameRemove user and their home directory :
sudo deluser --remove-home usernameIf the user owns files elsewhere, consider searching with find / -user username before deleting.
9. Useful checks and commands
- List all users (from /etc/passwd) : cat /etc/passwd
- View a single user's info : getent passwd username
- Check groups : id username or groups username
- Lock or unlock an account : sudo passwd -l username / sudo passwd -u username
10. Security tips
- Prefer strong passwords or SSH key logins for remote accounts.
- Use sudo instead of enabling direct root logins.
- Grant minimal privileges - add to sudo only when necessary.
- Regularly audit /etc/sudoers and group membership.







