LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 02-05-2015, 04:25 PM   #1
chass
LQ Newbie
 
Registered: May 2013
Posts: 7

Rep: Reputation: Disabled
How do I force password reset and expiration of new user


I need to be able to create new user accounts and make sure they're forced to reset their password upon first login, also if they don't log in within 4 days of the account creation their account must automatically lock. How do I accomplish this?

thank you.
 
Old 02-05-2015, 08:05 PM   #2
ulto
Member
 
Registered: Apr 2004
Posts: 52

Rep: Reputation: 1
'chage -d 0 username' will do the first part.
As for expiring accounts, well try 'chage -E $(date -d "+4 day" +"%D")' You may need to play around with it to get the date input to work but you get the idea.
Now how to tie that up with with a user never logging in, you will need to script it somehow, possibly write a cron job that will check chage -l for all users, grep the info you want and use that as a determination whether they satisfy your locking requirement.

Give it a go and see what you come up with.
 
Old 02-05-2015, 08:38 PM   #3
Miati
Member
 
Registered: Dec 2014
Distribution: Linux Mint 17.*
Posts: 326

Rep: Reputation: 106Reputation: 106
You can force a change of password by next login with passwd.
Not sure how well it'll work on batch creating users but for one at a time works well

Code:
       -e, --expire
           Immediately expire an account's password. This in effect can force
           a user to change his/her password at the user's next login.
 
Old 02-05-2015, 11:37 PM   #4
kapool
LQ Newbie
 
Registered: Feb 2015
Posts: 1

Rep: Reputation: Disabled
Quote:
Originally Posted by Miati View Post
You can force a change of password by next login with passwd.
Not sure how well it'll work on batch creating users but for one at a time works well

Code:
       -e, --expire
           Immediately expire an account's password. This in effect can force
           a user to change his/her password at the user's next login.
Thanks Miati! I will do as you suggest.
 
Old 02-06-2015, 12:08 AM   #5
Miati
Member
 
Registered: Dec 2014
Distribution: Linux Mint 17.*
Posts: 326

Rep: Reputation: 106Reputation: 106
This may be of interest:

Code:
       -i, --inactive INACTIVE
           This option is used to disable an account after the password has
           been expired for a number of days. After a user account has had an
           expired password for INACTIVE days, the user may no longer sign on
           to the account.
If you force a change of password by expiring it and set a inactive date of 4, if they do not login within 4 days... it's disabled.

This is in the man pages of passwd

Code:
man passwd
 
Old 02-06-2015, 02:37 PM   #6
chass
LQ Newbie
 
Registered: May 2013
Posts: 7

Original Poster
Rep: Reputation: Disabled
Great replies, thanks very much guys!
 
  


Reply


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 reset (forgotten) user password? Cartech3 Linux - Newbie 6 02-05-2012 02:31 AM
How to force user to change password after expiration in Linux? ssy68 Linux - Newbie 4 06-30-2011 03:54 PM
How to reset FTP user password? anandrhce Linux - General 2 08-27-2010 11:43 PM
Create user add file with default password and force user to change it? Morgandy Linux - Newbie 3 02-02-2010 06:06 PM
password expiration and user account lockout / disable automation frznchckn Linux - Security 1 05-05-2009 01:50 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:44 PM.

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