Search
Enter Keywords:
Home
OS X Script to Repair Permissions on All Volumes PDF Print E-mail
User Rating: / 0
PoorBest 
Written by Michael Salsbury   
Friday, 03 June 2005

This script, which can be executed from a command line or via cron, will attempt to repair permissions on all the drives attached to the system.  If, for any reason, permissions can't be repaired on a given volume (e.g., permissions are turned off on that volume), it will generate an error and move on to the next volume.

This script has been tested on OS X 10.3.x.  It may work on earlier or later OS X versions, but I don't warrant that.  By choosing to use this script, you assume all responsibility for the outcome (good or bad).  I do not support this script but will except bug fixes if you make any, or improvements.

#!/bin/csh
#
# This script will repair all disks on the system and also
# repair permissions on those disks.  Note that boot disks
# and certain others cannot be unmounted so they will not
# be repaired and some errors will be generated. This is normal.
#
# Updated: October 5, 2004
# By: Mike Salsbury
#
#
echo " "
echo "This script will repair permissions on the boot disk."
echo " "
echo "Enter the root/admin password when/if prompted."
echo " "
cd /Volumes
foreach d (*)
   echo "Repairing disk $d..."
   sudo diskutil repairDisk "/Volumes/$d/"
   echo "Repairing permissions on disk $d..."
   sudo diskutil repairPermissions "/Volumes/$d/"
   echo " "
end
echo "Finished repairing disks and permissions."
echo " "
echo "Be sure to run the unlock.command and lockdown.command scripts"
echo "after running this one, to ensure that the appropriate items are"
echo "locked down or unlocked."
echo " "