Operating System - HP-UX
1834462 Members
2922 Online
110067 Solutions
New Discussion

Re: Assign a directory for two different users

 
SOLVED
Go to solution
Bettina Ofner
Advisor

Assign a directory for two different users

Is it possible to assign a directory for two different users ?
Problem:
I have two users, belonging to one group.
I want the two users to read and write in a directory and their group only to read in this directory. Is this possible anyway?
Thanks
Bettina
7 REPLIES 7
A. Clay Stephenson
Acclaimed Contributor

Re: Assign a directory for two different users

Hi Bettina,

Yes, if I understand your question, it is possible. You will need to set acl's (Access Control Lists) for this directory. Acl's allow more explicit control for file/directory permissions. The bad news is that acl's are non-standard UNIX and most backups do not preserve the acl information so that if you have to do a restore, you must re-assert the acl data. You can keep a file with the acl statements that can be backed up so that you can run a script to reset the acl data. You can man getacl and setacl for details.

Regards, Clay
If it ain't broke, I can fix that.
Bettina Ofner
Advisor

Re: Assign a directory for two different users

Does this work on vxfs filesystem too ?
Can you give me an example ?
Thanks
A. Clay Stephenson
Acclaimed Contributor

Re: Assign a directory for two different users

Yes it does work on vxfs filesystems. The man pages mentions JFS - that is the old name or rather the alternate name for vxfs.

The examples in setacl are fairly clear but I suggest you create a play directory to test this.

For our example I'll use usera who is a member of groupa as the directory (dira) owner.

We set the permissions of dira to 750.
chown -R usera:groupa dira
chmod 750 dira.

Now everyone who is a member of groupa can read the directory but only usera can create files.
Now lets set acl's for userb (who is also a member of groupa).
setacl -m user:userb:7 dira

Now userb can also create files in dira.

You can also do the same operations on files.

Hope this gets you started, Clay
If it ain't broke, I can fix that.
Bettina Ofner
Advisor

Re: Assign a directory for two different users

What do I need for setacl ?
If I try the command I receive the message
sh: setacl: not found
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: Assign a directory for two different users

Hi Bettina,

You need OnlineJFS Version 3.3. Vrsn 3.1 does not support it - this is one of the new features. 3.3 is only available on 11.0 or 11i; if you are running 10.20 then forget it.

If you do not have OnlineJFS you could also do this in an HFS filesystem in a very similar way using chacl, lsacl, etc. commands.

Regards, Clay
If it ain't broke, I can fix that.
Bettina Ofner
Advisor

Re: Assign a directory for two different users

Thank you very much !
Bettina