adduser : Linux Command- Create New User account
What is adduser command?
- In Linux, a ‘useradd‘ command is a low-level utility that is used for adding/creating user accounts in Linux and other Unix-like operating systems.
- The ‘adduser‘ is much similar to useradd command, because it is just a symbolic link to it.
- To create a new user account under any Linux distribution use command called useradd.
- The system administrator is responsible for creating account. Login as root user (or use sudo command).
When we run ‘useradd‘ command in Linux terminal, it performs following major things:
- It edits /etc/passwd, /etc/shadow, /etc/group and /etc/gshadow files for the newly created User account.
- Creates and populate a home directory for the new user.
- Sets permissions and ownerships to home directory.
Basic syntax of command adduser:
useradd [options] {username}
Note:- To run this command, you have to logged in as root user or you have the root user privileges.
Example of adduser command:
# useradd satya
Set user Password in Linux:
Without password user account will be in locked status. To unlock the account, you need to use above passwd command. Use passwd command to assign a password and set password aging guidelines.
Basic syntax of command adduser:
passwd {username}
Example of adduser command:
passwd satya
Now let see the complete example:
[root@test ~]# useradd satya
[root@test ~]# passwd satya
Changing password for user satya.
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.