[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Give diferents permision to several groups?



> 
> I have a Folder name folder1 an 2 groups, group1 and group2.
> I want group1 to be able to change all the files inside folder1. But at 
> the same time I want group2 to only read the files in folder1. I do not 
> want to give any permission to any other users.

You cannot do this directly with the unix group system.  I would do the
following:  give the files in the directory folder1 the permissions 660,
and make them owned by group1.  Then write a small C-program that is
setguid group1, and does the following:

* check if the person who runs it is a member of group2 (use getuid,
getgid, and getgroups, see the info page of libc)

* if not --> exit
  else   --> cat the requested file

so that users of group 2 could do something like

cd folder1
viewit file | less

If you are not into C-programming, an alternative would be to have a
cron-script running that copies the files from folder1 to a second
folder, and do a chgrp group2 and a chmod 640 on the files.  Also make
sure that this second folder is not writeable for members of group2.

HTH,
Eric

-- 
 E.L. Meijer (tgakem@chem.tue.nl)          | tel. office +31 40 2472189
 Eindhoven Univ. of Technology             | tel. lab.   +31 40 2475032
 Lab. for Catalysis and Inorg. Chem. (TAK) | tel. fax    +31 40 2455054


Reply to: