Operating System - HP-UX
1827288 Members
3119 Online
109717 Solutions
New Discussion

script to source directory for files with a group of dba

 
SOLVED
Go to solution
Ratzie
Super Advisor

script to source directory for files with a group of dba

i am looking for a quick script that will look in a certain directory and find what files are owned by sshd and chgrp to dba.

I was hoping someone had already done this without reinventing the wheel.
4 REPLIES 4
Chris Watkins_1
Respected Contributor
Solution

Re: script to source directory for files with a group of dba

Should work fine.

find /DIRNAME -type f -user sshd -exec chgrp dba {} \;
Not without 2 backups and an Ignite image!
A. Clay Stephenson
Acclaimed Contributor

Re: script to source directory for files with a group of dba

cd /somedir
find . -user sshd -exec chgrp dba {} \;

Before I actually ran this I would do a "safe" command first, e.g.,
find . -user sshd -exec echo {} \;

Man find for details.
If it ain't broke, I can fix that.
Dave Hutton
Honored Contributor

Re: script to source directory for files with a group of dba

cd directory
find . -user sshd -exec chgrp dba {} ;\

Dave
Dave Hutton
Honored Contributor

Re: script to source directory for files with a group of dba

I typoed, Clay has the correct syntax. Should be \;

Not ;\

Dave