Add, modify and delete password of linux user

Question: How to add, modify and delete password of linux user

In this post i am going to explain how to add, modify and delete password of linux user

Step 1: Add a user and assign a password to same user

To add a user use below command
#useradd linux

To add password to a userĀ  use below command
#passwd linux

Check whether the password is setĀ  in /etc/shadow file. The password will be present in the second field and it will be encrypted.
#cat /etc/shadow | grep -iw linux

passwd1

 

 

 

 

 

 

Step 2: To modify password of a user
For adding and modifying password command is same
#passwd linux

Check whether the password is updated in /etc/shadow file. Now the old and new second field of user linux in /etc/shadow file will be changed. Hence the password is modified successfully
#cat /etc/shadow | grep -iw linux

passwd2

 

 

 

 

 

 

Step 3: Delete password of a user

To delete password of a user use below command
#passwd linux

Check whether the password is deleted in /etc/shadow file. The password will be present in the second field and it will be empty now.
#cat /etc/shadow | grep -iw linux

delete password linux




Leave a Reply

Your email address will not be published. Required fields are marked *