Link to home
Start Free TrialLog in
Avatar of lolaferrari
lolaferrariFlag for United Kingdom of Great Britain and Northern Ireland

asked on

redhat linux find perms + prune

I'm trying to find all files and dirs under an NFS Filer share where group doesn't have read and write. I have to exclude all instances of the backup dir .snapshot from the search


=Commands that work=

find /test/data -perm -g-r,-g-w | egrep -v -e '.snapshot' | xargs ls -l

find /test/data -perm -g-r,-g-w -exec ls -l {} \;


=Commands that don't work=

find /test/data  -name '\.snapshot'  -prune  -perm -g-r,-g-w | xargs ls -l 

(This command only looks at the .snapshot dir and runs the action on .snapshot


find /test/data  -path '\.snapshot'  -prune  -perm -g-r,-g-w | xargs ls -l

(This command lists the content of the users home dir which is a different path to which i'm searching)


The command that I can run does it with egrep but when it comes to executing the perms to make changes I want to be able to prune this dir out to save time since some of my filesystems are 500G


STRUCTURE OF DIR I'M GOING TO BE SEARCHING AND CHANGING.

/test/data

dir dir1

dir dir2

dir dir3

dir dir4

dir dir5

dir .snapshot


When it comes to changing the perms to 775 for instance I want to be able to run the command below but with -prune to save time when working on a 500G filesystem.

find /test/data -perm -g-r,-g-w -exec chmod 775 {} \;


I KNOW THIS WON'T WORK BASED ON FAILURE WITH THE FIND ABOVE WITH PRUNE 


find /test/data -name '\.snapshot'  -prune -perm -g-r,-g-w -exec ls -l {} \;




Thank you


ASKER CERTIFIED SOLUTION
Avatar of noci
noci

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of lolaferrari

ASKER

Oh thanks for that command will try it first thing in morning.

Arnold that's a great idea. These are shared NFS filers and hence the reason for this.can ACLs be used on NFS filers that are mounted ?

setfacl -m g:appgroup:rw -R /nfsfilermount
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Fantastic answers from all 3 experts