Operating System - HP-UX
1834483 Members
3619 Online
110067 Solutions
New Discussion

Re: Script for fallback file permission and ownership changes !!

 
Chris Fung
Frequent Advisor

Script for fallback file permission and ownership changes !!

Hi all,

Any idea to write a script to fallback the changed file permission and ownership information of Unix files and directories ?

It is easy to change the permission and ownership with "chmod -R" and "chown -R" commands However, I have difficult in writing the reverse stuff.....!!

Please help, many thanks,

Chris
2 REPLIES 2
Michael Tully
Honored Contributor

Re: Script for fallback file permission and ownership changes !!

The first place to probably start is to take a snapshot of the files before you change them into a reference file. The reference file could contain a fulle listing. From your script if you need to change them back, you would have to decide on some sort of condition. Depending on what the files are, as to whether other tools such as 'swverify' could help.

if
then
command
else
command
fi
Anyone for a Mutiny ?
Michael Steele_2
Honored Contributor

Re: Script for fallback file permission and ownership changes !!

Well, you're potentially in deep do do. For if enough permissions are changed on the core O/S file systems, /usr, /var, /opt, etc., then you've put your O/S into an unknown and unsupported state and HP will tell you to reinstall.

Use these commands:

check_patches

-or-

swverify -v -x check_permissions=true *and observe the results in swverify.log and swagent.log.

Good luck.
Support Fatherhood - Stop Family Law