Posted on 02-11-2020 06:02 AM
rm -rf /Users/$3/Desktop/*
rm -rf /Users/$3/Downloads/*
rm -rf /Users/$3/Documents/*
I've enabled the login/logout hooks in JSS
I've enabled the "Perform login hook actions in background"
I've scoped the policy with a trigger for logging in.
If I make this available in Self Service, it works flawlessly, but I need this to be automated during the user's login.
Posted on 02-11-2020 07:06 AM
I think you would need to define the username in the context of the script, certainly our login scripts if they need the user, run code rather than use the jamf variable. Something like:
consoleUser=$(ls -l /dev/console | awk '{ print $3 }')
rm -rf /Users/${consoleUser}/Desktop/*
Posted on 02-11-2020 07:32 AM
Apples recommended method would be to make a script and then use a LaunchAgent to launch the script at user login.