Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mac Reset Password Prompt [closed]

So I will do my best to explain what I am looking for assistance with.

So I am looking for a way to create a password reset prompt similar to what is out there for Windows. For example when a password expires on a domain for Windows it will ask for the current password and and a new password.

Here is a screenshot of what I am referring to: http://moritzlaw.osu.edu/technology/training/Windows7/PasswordPrompt.jpg

I am looking for a way to do the samething on a Mac that is NOT on a domain. I am looking to create some type of tool or script to be ran that will make it so the next time a user signs on, they have to change their password.

Thank you in advance for your help.

like image 601
falconspy Avatar asked Feb 18 '23 02:02

falconspy


2 Answers

loginwindow does this automatically when a user's password expires; the only trick is to make a local user's password expire. You can do this with the pwpolicy command:

pwpolicy -a adminuser -u usertoforcechange -setpolicy "newPasswordRequired=1"

There are a bunch of policies you can set, including minimum length, at least one letter, at least one digit, expiration period, etc. See the pwpolicy man page for details.

like image 189
Gordon Davisson Avatar answered Mar 08 '23 16:03

Gordon Davisson


You can force password expiration on non-activeDirectory non-OpenDirectory accounts by changing the default setting in the com.apple.loginwindow plist. NUMBER should be 0 if you want it expired now, or NUMBER for the number of days you want passwords to be valid for.

sudo defaults write /Library/Preferences/com.apple.loginwindow PasswordExpirationDays NUMBER
like image 36
jeremy Avatar answered Mar 08 '23 17:03

jeremy