Back to course

41. Managing Users: Adding New Accounts (`useradd`)

Linux Basics: From Zero to CLI Hero

Account Creation

Administrative tasks like managing users require superuser privileges, often accessed using sudo.

The useradd Command

useradd creates a new user account, but it is a low-level command that usually requires options to be truly useful.

Creating a User with Home Directory and Shell (-m and -s)

The -m option ensures a home directory (/home/newuser) is created. The -s option specifies the default shell (e.g., /bin/bash).

bash

Creating a new user named 'jdoe'

$ sudo useradd -m -s /bin/bash jdoe

Adding a Comment/Full Name (-c)

bash $ sudo useradd -m -c "John Doe, IT Department" -s /bin/bash jdoe

Note: After creating the user, the account is disabled until a password is set (covered in Lesson 45).