Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 02-07-2008, 04:19 PM   #1
LQ Newbie
Registered: Jan 2008
Posts: 10

Rep: Reputation: 0
How to force user to change password after expiration in Linux?

In Linux system, I have the password aging set to 2 days in /etc/login.defs. I created a user and password. After 2 days, when I try to login, the user is locked out because of password has been expired. Is there a way that can allow the user to login after the password expires, but force the user to change the password after login and the user is not allowed to do anything without changing a new password?

Old 02-07-2008, 04:42 PM   #2
Senior Member
Registered: Aug 2003
Location: UK
Distribution: Debian SID / KDE 3.5
Posts: 2,313

Rep: Reputation: 48
IF your using shadow suite, then simply set the inactive to how many days after the password expires to allow the user to change it. 0 means never make the account inactive.

To change a current user

usermod -f0 username

To make this the default for new users

useradd -D -f0
Old 02-11-2008, 12:59 PM   #3
LQ Newbie
Registered: Jan 2008
Posts: 10

Original Poster
Rep: Reputation: 0
I tried this, but I still can not login after the user password is expired, and there is no way to change password for the user except login as root. Is there any other way or script or so can do the thing as I expected?

Old 02-11-2008, 02:32 PM   #4
LQ Newbie
Registered: Jan 2008
Posts: 10

Original Poster
Rep: Reputation: 0
I also tried to use "passwd -e user" to expire a user and see if the force password changing functionality work, but I don't see the prompt to force me to change password. Is my linux system or PAM module has problem? or there is any configuration I need to change to see the force prompt? or I need other modules to make work? How to debug/fix this issue?

Old 06-30-2011, 03:54 PM   #5
LQ Newbie
Registered: Mar 2010
Posts: 1

Rep: Reputation: 0
To quickly expire an account and have it prompt for change

chage -d 0 <username>


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to force a user to change their NIS password at logon? synthol6 AIX 1 08-17-2010 09:47 PM
How to force a user/password prompt to logon? binary66 Puppy 5 09-08-2006 06:50 AM
How to force user to enter username and password sxcheng Linux - Security 1 02-23-2005 06:46 AM
Password expiration klmn1 Linux - Networking 1 12-26-2002 01:08 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:49 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration