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:

  1. Open a terminal on the Linux system using an account with sudo privileges.
    $ whoami
    root
  2. Create the user account with adduser in non-interactive mode.
    $ adduser --disabled-password --gecos "" appuser
    info: Adding user `appuser' ...
    info: Selecting UID/GID from range 1000 to 59999 ...
    info: Adding new group `appuser' (1005) ...
    info: Adding new user `appuser' (1005) with group `appuser (1005)' ...
    info: Creating home directory `/home/appuser' ...
    info: Copying files from `/etc/skel' ...
    info: Adding new user `appuser' to supplemental / extra groups `users' ...
    info: Adding user `appuser' 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.

  3. Input the desired password for the new user when prompted and retype it to confirm.
    $ passwd appuser
    New password: Retype new password: passwd: password updated successfully

    Weak or reused passwords increase the risk of account compromise, especially on systems exposed to untrusted networks.

  4. Verify that the account exists and has its own user and group identifiers using id.
    $ id appuser
    uid=1005(appuser) gid=1005(appuser) groups=1005(appuser),100(users)

    A successful output with a unique uid and gid confirms that the user and primary group were created.

  5. Confirm that the home directory was created and populated with default configuration files from /etc/skel.
    $ ls -la /home/appuser
    total 20
    drwxr-x--- 2 appuser appuser 4096 Dec 22 06:15 .
    drwxr-xr-x 1 root    root    4096 Dec 22 06:15 ..
    -rw-r--r-- 1 appuser appuser  220 Dec 22 06:15 .bash_logout
    -rw-r--r-- 1 appuser appuser 3771 Dec 22 06:15 .bashrc
    -rw-r--r-- 1 appuser appuser  807 Dec 22 06:15 .profile

    Files such as ~/.bashrc and ~/.profile are copied from /etc/skel for a consistent default shell environment.

Discuss the article:

Comment anonymously. Login not required.