In Linux, you can manage user accounts through command-line tools or graphical applications. The most widely used command-line tools for creating users are adduser and useradd. Additionally, most Linux desktop environments and distributions offer graphical tools that serve as frontends for these command-line utilities.
These tools write user information to the /etc/passwd, /etc/group, and /etc/shadow files and create a user's home directory, populating it with necessary files from /etc/skel.
You can either manually add user information to these files or use dedicated tools like adduser, an interactive command-line tool found in most Linux distributions by default.
Graphical methods to create user for different Linux distributions:
Steps to create new user account in Linux:
- Open a terminal application.
- Run the adduser command followed by the desired username as an argument.
$ sudo adduser username
- If prompted, enter the password for the current user.
[sudo] password for user:
Current user needs to have administrator privilege on the system.
- The adduser tool will request additional user details.
Adding user `username' ... Adding new group `username' (1001) ... Adding new user `username' (1001) with group `username' ... Creating home directory `/home/username' ... Copying files from `/etc/skel' ...
- Input the desired password for the new user and press [ENTER], twice.
New password: Retype new password: passwd: password updated successfully
- Provide optional informational values or press [ENTER] to leave them blank and continue.
Changing the user information for username Enter the new value, or press ENTER for the default Full Name []: Room Number []: Work Phone []: Home Phone []: Other []:
- Press Y and [ENTER] to confirm that the information is accurate, allowing adduser to create the new user account.
Is the information correct? [Y/n] y
Manual: adduser(8) - Linux man page
Mohd Shakir Zakaria is an experienced cloud architect with a strong development and open-source advocacy background. He boasts multiple certifications in AWS, Red Hat, VMware, ITIL, and Linux, underscoring his expertise in cloud architecture and system administration.
Comment anonymously. Login not required.