Delete User on Logout

Polybius
New Contributor III

I run a bunch of Macs with MyPC at my library. It uses the same Active Directory account to log in for every user. Currently, we use Deep Freeze as a means to keep personal information from remaining between sessions. I would like to remove our dependance on Deep Freeze and some of the issues it has. To accomplish this, I was thinking I could delete the MyPC mobile account that gets used during login (using dscl and rm -rf on the home directory). That would remove any files or settings from the previous user.

There doesn't seem to be a way to run a script after a user logs out.

Does anybody know of a way to do this?

1 REPLY 1

Fluffy
Contributor III

As Login Hooks are deprecated, the only accepted solution I could find anywhere is @Bruienne's script linked in this thread: https://community.jamf.com/t5/jamf-pro/how-can-i-use-launchd-to-run-logout-script/td-p/42209

It doesn't sound like a perfect solution, as the script will be killed if takes too long.

We use a launchagent with our MacBook cart that logs a user out when the lid is closed and will delete the Guest folder, but still need something for our iMacs. If you figure something out that works, I would be interested to hear about it.