In Linux, separate user accounts isolate permissions, keep personal files contained, and improve auditing for multi-user systems. Interactive account creation tools simplify the process while avoiding direct edits to sensitive system files such as passwd and shadow.
On Ubuntu and other Debian-based systems, the adduser helper wraps the lower-level useradd command, creating a primary group, home directory, and shell for the account in one operation. User information is stored in system databases and a new home directory under /home is populated with default configuration files copied from /etc/skel.
Creating accounts requires administrative privileges because system user databases control access to files, processes, and services. Strong passwords, unique usernames, and clear separation between regular logins and system or service accounts reduce the chance of privilege misuse or configuration conflicts.
Steps to add a user in Linux:
- Open a terminal on the Linux system using an account with sudo privileges.
$ whoami root
- Create the user account with adduser in non-interactive mode.
$ sudo adduser --disabled-password --gecos "" audituser info: Adding user `audituser' ... info: Selecting UID/GID from range 1000 to 59999 ... info: Adding new group `audituser' (1002) ... info: Adding new user `audituser' (1002) with group `audituser (1002)' ... info: Creating home directory `/home/audituser' ... info: Copying files from `/etc/skel' ... info: Adding new user `audituser' to supplemental / extra groups `users' ... info: Adding user `audituser' to group `users' ...
The adduser helper creates a matching primary group and home directory for the new account.
A username that conflicts with an existing system or service account can break running services or cause login confusion; avoid names like www-data, daemon, or mail.
- Set a password for the new user.
$ echo 'audituser:Passw0rd!' | sudo chpasswd
Weak or reused passwords increase the risk of account compromise, especially on systems exposed to untrusted networks.
- Verify that the account exists and has its own user and group identifiers using id.
$ id audituser uid=1002(audituser) gid=1002(audituser) groups=1002(audituser),100(users)
A successful output with a unique uid and gid confirms that the user and primary group were created.
- Confirm that the home directory was created and populated with default configuration files from /etc/skel.
$ sudo ls -la /home/audituser total 20 drwxr-x--- 2 audituser audituser 4096 Jan 11 21:41 . drwxr-xr-x 1 root root 4096 Jan 11 21:41 .. -rw-r--r-- 1 audituser audituser 220 Jan 11 21:41 .bash_logout -rw-r--r-- 1 audituser audituser 3771 Jan 11 21:41 .bashrc -rw-r--r-- 1 audituser audituser 807 Jan 11 21:41 .profile
Files such as ~/.bashrc and ~/.profile are copied from /etc/skel for a consistent default shell environment.
Manual: adduser(8) - Linux man page
Mohd Shakir Zakaria is a cloud architect with deep roots in software development and open-source advocacy. Certified in AWS, Red Hat, VMware, ITIL, and Linux, he specializes in designing and managing robust cloud and on-premises infrastructures.
