1832276 Members
1972 Online
110041 Solutions
New Discussion

Re: A script wanted

 
SOLVED
Go to solution
peterchu
Super Advisor

A script wanted

I have many many files in my system as below , I want to change the file permission of these files , if the owner group is not "sys" ( eg. ACC ,EDP ,ITT ) , then change the file permission to 777 , could suggest the script that can make it ? thx



-rw-r--r-- 1 root ACC 103 May 29 2003 aaaa18964
-rw-r--r-- 1 root EDP 28 Dec 9 2003 baaa10999
-rw-r--r-- 1 root ITT 28 May 29 2003 baaa18964
-rw-r--r-- 1 root sys 28 Dec 9 2003 caaa10999
-rw-r--r-- 1 root sys 28 May 29 2003 caaa18964
2 REPLIES 2
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: A script wanted

First of all, generally speaking, 777 is not a wise choice but if that's what you want:


find . ! -group sys -type f -exec chmod 777 {} \;

You should replace the -exec chmod 777 {} \; with a safe command (-exec ls -l {} \;) until you get the filters exactly like you want them. Man find for details.

You are opening up huge security holes with 777 and no executables should not have the executable bit set in any event.
If it ain't broke, I can fix that.
A. Clay Stephenson
Acclaimed Contributor

Re: A script wanted

Oops, that last sentence should read:

You are opening up huge security holes with 777 and non-executable files should not have the executable bit set in any event.
If it ain't broke, I can fix that.