In Linux, creating new user accounts is essential for managing multiple users on a system. You can use command-line tools like adduser or useradd to add new users quickly and efficiently. These tools are available by default in most Linux distributions, including Ubuntu, and are preferred for their speed and ease of use.
Both tools add new user details to critical system files such as passwd, group, and shadow. They also generate a home directory for the user, copying default configuration files from the skel directory. This ensures that the new user has the necessary environment ready upon creation.
Although it is possible to manually edit these files, using adduser automates the process, minimizing errors. The tool prompts for essential user information like username and password. Most Linux distributions also offer graphical tools for user management, but the command-line option remains a reliable and efficient method.
Graphical methods to create user for different Linux distributions:
Steps to add a user in Linux:
- Open a terminal.
- Run the adduser command followed by the desired username as an argument.
$ sudo adduser username
- Enter the password for the current user if prompted.
[sudo] password for user:
The current user needs administrative privileges to create a new account.
- 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
The adduser command will handle the creation of the home directory and copy default configuration files.
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.