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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

file permissions 1

Status
Not open for further replies.

apocalypse11

Technical User
Jan 11, 2001
77
AU
Hi,

have a file in a folder... with permissions set: rw-r--r-- which means it is read only for everyone but the owner. Problem is, I need the file to have two owners because two people need to write to it, but i still need the rest of the group to only have read only access.

Thanks...
 
just an idea, but what about setting up a common user whose password would only be known by the two who have to write to the file and change the ownership to that user? and you can also set it up so that the users must su - username to be able to write to the directory.
 
Since the file is world readable you could setup a common group that just contains both users and change the group owner to this new group. chmod the file 664 and you should be good.

Another option is to use ACL's. This would have 2 main disadvantages. First, each flavor of unix does them differently. Second, you don't see them in ls so you sometimes forget that the acl is there. Can lead to debugging fits until you remeber that you setup an ACL.

Hope that helps.
 
bi - I am sorry. I should have mentioned that these people are using samba to access the file via a windows machine.

usige - The only problem is that I need the current group to have read only access. I can't change that group. So the end product would be a file with 2 people who can read/write it and a group who can only read the file.

Thanx.
 
As usige said, since the file is "world" readable (i.e. readable by everyone) you can achive this by creating a common group for the two users that need to write to the file.

You will need to do the following:

(1) create a new group.
(2) change the group of the file to the new group.
(3) make the file writable by the group.
(4) make the two users that need to update the file members of the new group.

Since all the other users are still only members of the old group, they will not be able to write to the file, but they still can read it. Only the two users that are members of the new group and the owner will be able to write to the file.
 
ok thanks - that worked. I'm pretty new at this all. So forgive my silly questions: "world" readable - what is that, and that should explain why i didn't understand?
 
apocalypse11,
Traditionally in UNIX you have three sets of permissions. Owner, group, and world (or other). When checking to see if you can access a file, first the system checks to see if you are the file owner. If so it will check to see if the owner permision set allows you access. If not, it then checks to see if you are a member of the file's group. If you are the checks are performed against the group permissions. Finally if you are neither the owner or a member of the group the system checks to world/other permission set. Since your file is rw-r--r--, the owner has read/write, the group has read, and world has read. Since the file is world readable it doesn't matter what group you are in. If you can login to the system you can read the file.

Hope that helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top