Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to grant the file privilege

Status
Not open for further replies.

IPOz

Programmer
Jul 11, 2001
109
CN
Hi,friends
I have a file called test.c as below:
#ls -l
-rw-r----- 1 myname mygroup 8352 Aug 14 14:57 test.c

Now i want to grant the user B read only this file and user C write only it.How can i get it?
if
#usermod -G mygoup B
the user B can read test.c only.But i donot know how to make user C write test.c only.

Any help is appreciated!
IPO_z@cmmail.com
Garbage in,Garbage out
 
Maybe it is difficult to implement your goal.I think the privilege bits are not enough :(

Do you think about the PAM?

Regards! zallen@cmmail.com
Long live of freedom!
 
Owner read only user
write only group member
------------------------
chmod 420 file name
chown reader file name

(make a writeonly group for the files and place
the second user in it.)

chgrp writers file name

This can be clunky to learn but is very flexible.

ex:
All my users from proofreading use the single user
account proofer.
All my programmers are members of the oops group.
 
marsd,
I understand what you said. But is it possible to implement it without changing the ownership?
In windows i only need to share the directory in which the file lives.I can easily control who can read the file and who can write the file.

Regard! zallen@cmmail.com
Long live of freedom!
 
You are talking about "inherited permissions."..No
this is not the way permissions work I am afraid.
No, I really don't see a way around this..unless
you would like to wrap the whole thing in a custom
shell script-which might be a little safer than having
one group have blind writes...
Maybe there is a PAM plugin for this...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top