Create Linux User Account

We can create user in Linux/Unix using useradd command. useradd creates a new user or update default new user information. Once user

Syntax:

useradd [options] LOGIN
useradd -D
useradd -D [options]

Whenever a user is created in Linux/Unix, following things created by default:

  • A user home directory is created at /home/username
  • A mail box is created at /var/spool/mail
  • Unique UID and GID are given to user.

Examples:

Create a user with the name kalpesh

useradd k2admin1

To set the password, use passwd command. To see How to set password for linux user

Create user with own attriubtes

useradd k2admin2 -u 556 -c “k2schools account administrator” -d /opt/k2admin -s /bin/sh

To check the user existing or not:

cat /etc/passwd | grep k2admin2

Note: It is good practice, that should provide a label or some description for each account. Otherwise, after sometime we will forgot what it is for.

Options:
Create Linux User Account

Powered by k2schools
Skip to toolbar