Guide to “useradd” Command in Linux

Basic syntax of command is:

useradd [options] username

When we add a new user in Linux with ‘useradd‘ command it gets created in locked state and to unlock that user account, we need to set a password for that account with ‘passwd‘ command.

[root@tecmint ~]# useradd tecmint

[root@tecmint ~]# passwd tecmint
Changing password for user tecmint.
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.

Once a new user created, it’s entry automatically added to the ‘/etc/passwd‘ file. The file is used to store users information and the entry should be.

tecmint:x:504:504:tecmint:/home/tecmint:/bin/bash

 

 


The Complete Guide to “useradd” Command in Linux – 15 Practical Examples

Annunci