Creating a new user account on a Linux operating system is a fundamental administrative task. The following steps describe a standard and secure approach applicable to most Linux distributions.
Steps to Create a New User
1. Open the Terminal
Open the terminal on your Linux system. This can typically be done using the keyboard shortcut:
Ctrl + Alt + T
Alternatively, search for Terminal in the application menu.
2. Log In as Root or Use sudo
If you are already logged in as the root user, you may proceed to the next step. Otherwise, use sudo to gain superuser privileges.
sudo su -
Note:
Direct root access may be disabled on some systems. In such cases, continue usingsudowith each administrative command.
3. Create a New User
To create a new user, use either adduser or useradd. The adduser command is recommended because it automatically configures default settings such as the home directory and shell.
adduser new_username
You will be prompted to:
- Set a password for the new user
- Enter optional user information (full name, phone number, etc.)
4. Set or Update the User Password
If needed, you can manually set or update the password for the new user using:
passwd new_username
5. Grant Additional Privileges (Optional)
If the new user requires administrative (superuser) privileges, add the user to the appropriate group.
Debian / Ubuntu-based distributions:
usermod -aG sudo new_username
RHEL / CentOS / Rocky / AlmaLinux:
usermod -aG wheel new_username
This allows the user to execute commands using sudo.
6. Log Out or Switch to the New User
After creating the user, you may log out from the current session or switch directly to the new account.
exit
su - new_username
Best Practices
- Avoid logging in directly as
rootfor daily operations. - Grant
sudoaccess only when necessary. - Use strong, unique passwords for all user accounts.
- Regularly audit user and group memberships.
Top comments (0)