1833017 Members
2368 Online
110048 Solutions
New Discussion

file mode

 
SOLVED
Go to solution
peterchu
Super Advisor

file mode

We have a share directory eg . /home/edp/temp , the user ( eg. userA ) will generate the files to this directory and other user ( eg. userB ) need to update the files in this directory , but the mode of the file is 644 when the userA create it , so userB can't update it , userA and userB is not same user group , except change the umask (umask 000) and cron job , is it possible to change all the files in the directory /home/edp/temp is 666 once the userA create it ? thx.
3 REPLIES 3
Ashwani Kashyap
Honored Contributor

Re: file mode

What version of OS are you using . If you are 11i and use JFS version 4 its pretty easy to use ACL's for these kind of file/directory permission .

I did not work with ACL on other JFS versions except 4 , I am assuming it should be easier too .

Basically getacl and setcl are the commands you need to run against the file name with proper user/group permissions . do man on them for more details and get the ACL maulas at www.docs.hp.com .
Shaikh Imran
Honored Contributor

Re: file mode

Hi,
In addition to the above,
You can also try using a sticky bit for that directory.
#chmod 1644 /home/edp/temp
sticky bit set for a directory will make that directory as sharable.

Regards,

I'll sleep when i am dead.
Elmar P. Kolkman
Honored Contributor
Solution

Re: file mode

AFAIK the sticky bit will make files only removable by the owner or root in a directory (see /tmp).

The best solution I can think of right now: put both users in a group, change the mode of the directory to 2770 or 2775 (meaning a setgid for the directory) and the directory of course of the same group as both users are in. Set the umask to 002 for both users, meaning files are created user and group writable.

If you want userB to only be able to change the files, not create or rename files in the dir, you might try 2755 as mode for the directory, because he doesn't need write access to the directory to change the contents of files, just write access to the files which he gets due to the setgid on the directory and the umask of userA.
Every problem has at least one solution. Only some solutions are harder to find.