Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

9/18/2019 Manage local users in linux with useradd, usermod, chage & passwd command

Home
Contact Us
About Us
Write For LinuxTechi

Home
Commands
How To  1 FOLLOW: 
Commands
Shell Scripting
Monitoring Tools
Linux Commands to manage
Linux Interview
Linux ebooks
Local Accounts – useradd,
Write For LinuxTechi
Contact Us

usermod, chage & passwd


About Us

by Pradeep Kumar · Published February 11, 2016 · Updated February 17, 2019

User administration is one of the important task of Linux Share

system administrator. Local accounts or users in Linux like



operating system is managed by useradd, usermod,
userdel, chage and passwd commands.

useradd command is used to create new accounts in
Linux 
usermod command used to modify the existing
accounts in linux 
userdel command is used to delete local account in

linux
passwd command used assign password to local
accounts or users. 
chage comamnd is used to view & modify users
Try 30 days free.

password expiry information


Syntax of ‘useradd’ command
SIGN UP

# useradd <options> <username_or_login>

Options used in useradd command :

SUBSCRIBE TO
NEWSLETTER

Enter your email here

I consent to my submitted data


being collected via this form*

https://www.linuxtechi.com/linux-commands-to-manage-local-accounts/ 1/7
9/18/2019 Manage local users in linux with useradd, usermod, chage & passwd command

SIGN UP NOW

we respect your privacy and take protecting it


seriously

Most Popular Post

 

How to Configure SFTP Server


with Chroot in Debian 10

Syntax of usermod command : How to Collect System and


Application Metrics using
# usermod <options> <username_or_login> Metricbeat

Options used in usermod command. How to Setup Multi Node


Elastic Stack Cluster on RHEL
8 / CentOS 8

Different Ways to Configure


Static IP Address in RHEL 8

How to Install Ansible


(Automation Tool) on Debian
10 (Buster)

Syntax of userdel command: How to Create Availability


Zones (AZ) in OpenStack from
Command Line
# userdel <options> <username_or_login>

Options used in userdel command : How to Setup Disk Quota on


XFS File System in Linux
Servers

Learn how to Install LXD /


LXC Containers in Ubuntu
Syntax of chage :
# chage <options> <username_or_login>

Find LinuxTechi on Facebook


Options used in chage command :

https://www.linuxtechi.com/linux-commands-to-manage-local-accounts/ 2/7
9/18/2019 Manage local users in linux with useradd, usermod, chage & passwd command

Linuxtechi
2,037 likes

Like Page Send Message

Be the first of your friends to like this


Syntax of passwd Command :
# passwd <username_or_login>

For more details on passwd command please refer ‘10


passwd command examples in Linux‘

In this article we will discuss different examples of user


administration on CentOS 7 & RHEL 7.

Example:1 Create a local account &


assign password.
User the below syntax to create and assign to the
username.

# useradd <username> ; echo -e "


<newpassword>\n<newpassword>" | passwd username

Let’s create a username ‘harry’ and assign password.

[root@linuxtechi ~]# useradd harry ; echo -e


"Roxicant@123#\nRoxicant@123#" | passwd harry
Changing password for user harry.
New password: Retype new password: passwd: all
authentication tokens updated successfully.
[root@linuxtechi ~]#

Note : When a user is created in Linux followings are


updated:

A home directory is created under


‘/home/<username>’
User info is updated in ‘/etc/passwd’ file
Group Information is stored in ‘/etc/group’
password info is updated in ‘/etc/shadow’ file.
File for user’s email is created under
‘/var/spool/mail/<username>’

Example:2 Create a user with customize


settings
Let’s create a user with following options :

UID = 2000
GID = 5000
Comments = ‘Admin Account of SAP’
Home Directory = /opt/sap

https://www.linuxtechi.com/linux-commands-to-manage-local-accounts/ 3/7

You might also like