Policy not deleting an account

jarednichols
Honored Contributor

Hi-

I'm trying to make a self service policy that will remove a known setup account. However, when you run it, it doesn't actually remove the account. Jamf.log checks out ok but there's not much detail there. I can however, successfully remove the account with remote.

any ideas?

j
---
Jared F. Nichols
Desktop Engineer, Infrastructure & Operations
Information Services Department
MIT Lincoln Laboratory
244 Wood Street
Lexington, Massachusetts 02420
781.981.5436

3 REPLIES 3

rmanly
Contributor III

You could try doing it with a script instead of 'jamf deleteAccount'
dscl . -delete /Users/$USER
rm -rf /Users/$USER

tlarkin
Honored Contributor

I was going to suggest the same thing, but maybe do it via a loop

This is going to assume you know the user name

#!/bin/bash

#see if the current user is there

bad_user=/bin/ls /Users | grep <shortname> -c

#now compare to execute deletion

if [ $bad_user -eq 1 ] ; do

/usr/sbin/dscl . -delete /Users/$bad_user

/bin/rm -rf /Users/$bad_user

else echo "$bad_user not found"

fi

done

exit 0

That was very quick and dirty, so of course test test test



Thomas Larkin
TIS Department
KCKPS USD500
tlarki at kckps.org
blackberry: 913-449-7589
office: 913-627-0351

rmanly
Contributor III

I like your grep -c test !
I should have stated these are the commands you need now run with it ;)