- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to Force User to Change Password at Next Login in Linux?
Because of security concerns, the users in a system are required to update their passwords regularly. In this article we will see how we can force an user to change their password when they login to the system next time.
List the users
First lets have a look at the users available in the system.
$ cut -d: -f1 /etc/passwd
Running the above code gives us the following result −
mail news uucp proxy www-data backup list … Ubuntu uname1
Check user Details
Next we check the settings for users current password system configuration.
$ sudo chage -l uname1 [sudo] password for ubuntu:
Running the above code gives us the following result −
Last password change: Dec 30, 2019 Password expires: never Password inactive: never Account expires: never Minimum number of days between password change: 0 Maximum number of days between password change: 99999 Number of days of warning before password expires: 7
Set the expire Option
Now we sue the expire option to set the timeline for password expiry and then query it with the chage to find the expiry implemented.
$ sudo passwd --expire uname1 passwd: password expiry information changed. $ sudo chage -l uname1
Running the above code gives us the following result −
Last password change: password must be changed Password expires: password must be changed Password inactive: password must be changed Account expires: never Minimum number of days between password change: 0 Maximum number of days between password change: 99999 Number of days of warning before password expires: 7
Advertisements