SUN: Restoring file permissionsΒΆ

Title:SUN: Restoring file permissions
Author:Douglas O’Leary <dkoleary@olearycomputers.com>
Description:SUN: Restoring file permissions
Date created:08/2001
Date updated:09/2001
Disclaimer:Standard: Use the information that follows at your own risk. If you screw up a system, don’t blame it on me...

This little trick comes in handy if you or someone you know and love decided to do a global chmod/chown, etc. It relies on the SUN package installation information, so if you didn’t use that, you’re out of luck.

All files installed via pkgadd have the filenames and original file permissions hiding in /var/sadm/install/contents. Presupposing that enough of your system is left to write a script, you can either use the file to update the file permissions yourself or do the following:

  • ok boot cdrom -s
  • Mount / on /a, /usr on /a/usr, /var on /a/var, and /opt on /a/opt
  • # pkgchk -R /a -f

Your system will have all the permissions reset to the originals that were in the installation packages

WITH the exception that suid, sgid, or sticky bits are not set. You’ll have to go through the contents file yourself or take that into account when you write the script.