Operating System - HP-UX
1753501 Members
3751 Online
108794 Solutions
New Discussion юеВ

Recursive usage of setacl & getacl command

 
SOLVED
Go to solution
Shameer.V.A
Respected Contributor

Recursive usage of setacl & getacl command

Hi,
Can anyone provide me with the command option for setacl & getacl HPUX commands.

I need to set the ACL permission for the directory & the sub-directory & files recursively. (Similar to chmod -R)

OS: HP-UX 11.11

Thanks,

Shameer
.... See invisible, feel intangible and achieve impossible as everything is possible ....
5 REPLIES 5
Pete Randall
Outstanding Contributor

Re: Recursive usage of setacl & getacl command

How about a simple for loop:

for file in `find /startdir`
do
setacl
done


Pete

Pete
OldSchool
Honored Contributor

Re: Recursive usage of setacl & getacl command

how about a script that does the getacl / setacl and you run it via "find". something like:

myscript.sh contains something like:
getacl $1
setacl ...... $1

then you run it with:

find -p -exec myscript.sh {} \;

???
Peter Nikitka
Honored Contributor

Re: Recursive usage of setacl & getacl command

Hi,

I suggest to create two ACL-files (see the option '-f' in 'man setacl'):
one for directories (containing default ACLs for objects created in the future) - e.g. /tmp/mydir.acl - and one for plain files - /tmp/myfile.acl .
Then use
find mydir -type d | xargs setacl -f /tmp/mydir.acl
find mydir -type f | xargs setacl -f /tmp/myfile.acl

Use an additional option '-n' if you think so after having read the corresponding section in the man page.

mfG Peter
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"
Akram Shaik
Frequent Advisor
Solution

Re: Recursive usage of setacl & getacl command

Somthing like this which I used in past to set group ACL's to all subfolders and files

find /tmp/ -type d -exec setacl -m group::r-x -m default:group::r-x {} \;
find /tmp/ -type f -exec setacl -m group::r-x {} \;


Cheers
Akram
when everyting is coming your way then you are in the wrong lane
Yogesh M Puranik
Valued Contributor

Re: Recursive usage of setacl & getacl command

Hi,

Shameer,If u want to use setacl and get acl,follow this......


suppose the current directory is:
/home/yogesh/shameer/personal/logs.Whose owner and group is yogesh:yogesh...

1]check out your current directory.
#pwd
ex./home/yogesh/shameer

2]If you want to set the acl for directory personal, for the user shameer, to whom you wana assign rwx permission.Below is the procedure.."Well -R option is not there for acl."


#setacl -m user:shameer:rwx personal

It will set acl to the folder "personal" and shammer can use that folder w/o any restriction.

3]If you wana check the acl details for the directory "personal".Go to /home/yogesh/shameer n Just run..

# getacl personal.

You will get the details of the same.For more detals check man setacl and getacl.


I hope you, understood what am trying to explain.If you are happy with my explanation, please do assign the points.



cheers!!!

-Yogesh