This script is intended for use with shared-Mac environments, and helps to remove old users and home directories to free up space and de-clog the login window.
There are 2 key ways this script functions:
-
Secure Delete (--secure): Use caution with this method. Secure delete will look for accounts not used in your specified day range, then delete their user record and home folder. The use of an LA is not required
Example Usage: For a secure delete based on accounts not used in 14 days:
./PruneUsers.sh --secure 14 -
Soft Delete (--soft): When using the soft delete option, it should be used alongside the accompanying LaunchAgent (com.maxhewett.UserPruner.plist) which will delete the home folders that are identified by this script. This deletion will occur 30 days after the user is soft deleted.
Example Usage: For a dry run soft delete based on accounts not used in 45 days:
./PruneUsers.sh --soft --dry-run 45
PruneUsers.sh [options] [days_inactive]
Soft Delete (default):
When using this script with the soft delete option, it should be used alongside the accompanying
LaunchAgent (com.maxhewett.UserPruner.plist) which will delete the home folders that are identified
by this script. This deletion will occur 30 days after the user is soft deleted.
Example Usage:
For a dry run soft delete based on accounts not used in 45 days:
./PruneUsers.sh --soft --dry-run 45
-----------------------------------
Secure Delete:
Use caution with this method. Secure delete will look for accounts not used in your specified day range,
then delete their user record and home folder. The use of an LA is not required
Example Usage:
For a secure delete based on accounts not used in 14 days:
./PruneUsers.sh --secure 14
-----------------------------------
options:
-h --help show this help text
-v --verbose verbose output
-n --dry-run dry run simulation
--secure perform secure deletion
--soft perform soft deletion
--debug show all debug output
-----------------------------------
Changing Default Options:
Modify the accompanying LaunchAgent ProgramArguments. Default is soft delete, 30 days.`