Local Password policy

joshuay
New Contributor

All,
I'm trying to create a script that is used as a logout/login hook to force the user to reset their password. I've been using the "newPasswordRequired=1" command and it seems to work ok locally, but when I try to use it via the JSS I get the following error: Script exit code: 139
Script result: /private/tmp/current.sh: line 5: 90168 Segmentation fault: 11 pwpolicy -u "$current" -setpolicy "newPasswordRequired=1"

Anyone have any ideas or recommendations for forcing local user password resets? Below is the script I'm trying to get to work.

#!/bin/bash

current=$( whoami )

pwpolicy -u "$current" -setpolicy "newPasswordRequired=1"

1 ACCEPTED SOLUTION

SeanA
Contributor III

If the script is being run through Casper, then the variable $3 will pass through the current user so

#!/bin/bash
pwpolicy -u $3 -setpolicy "newPasswordRequired=1"

would make it shorter and might solve it.

View solution in original post

4 REPLIES 4

SeanA
Contributor III

If the script is being run through Casper, then the variable $3 will pass through the current user so

#!/bin/bash
pwpolicy -u $3 -setpolicy "newPasswordRequired=1"

would make it shorter and might solve it.

JPDyson
Valued Contributor

Sean beat me to it; use $3.

joshuay
New Contributor

Thanks guys that worked!

rgranholm
Contributor

If you use this script and already have a config profile for certain password requirements, will they work in tandem?