Skip to main content
Solved

Local Password policy

  • January 10, 2013
  • 4 replies
  • 16 views

Forum|alt.badge.img+3

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"

Best answer by SeanA

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.

4 replies

Forum|alt.badge.img+12
  • Contributor
  • Answer
  • January 10, 2013

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.


Forum|alt.badge.img+13
  • Valued Contributor
  • January 10, 2013

Sean beat me to it; use $3.


Forum|alt.badge.img+3
  • Author
  • New Contributor
  • January 10, 2013

Thanks guys that worked!


Forum|alt.badge.img+7
  • Contributor
  • August 9, 2016

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