LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to mark file as read-only when not owner of file (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-mark-file-as-read-only-when-not-owner-of-file-4175499262/)

tqz 03-24-2014 07:06 AM

How to mark file as read-only when not owner of file
 
Hi All

I have linux and ACL permissions set on dirs. Is it possible to mark a file as read-only, if the user has not created the file (not owner), but is apart of the group which owns the file and has full permissions on it? If so, how would this be done?

Thanks
t.

NotionCommotion 03-24-2014 07:10 AM

I would think you could. What happens when you use chmod?

jdkaye 03-24-2014 07:12 AM

You can use the chmod command to modify the permissions. Typing
Code:

man chmod
will explain how to do it.
jdk

tqz 03-24-2014 07:50 AM

Hi and thanks for the responses.

I know how to use the chmod command /set acl permissions to change the file to read only via the command line, but I want a user to be able to mark files as read-only (if they have rwx permissions) via their windows PC (right click the file, and mark as read-only via properties). This only seems to work if the user is the owner of the file...

t.

NotionCommotion 03-24-2014 08:14 AM

I too can't seem to do so, even from the shell. That would be a client such as Filezilla couldn't as well.

File is owned by UserA and has permission 775.
UserB belongs to UserA group
UserB can't seem to change permission to 777.

jpollard 03-24-2014 11:00 AM

From the manpage on the library function "chmod" (man 3 chmod):
Quote:

The application shall ensure that the effective user ID of the process
matches the owner of the file or the process has appropriate privileges
in order to do this.
So only the owner of a file, or root may change the access rights.

Madhu Desai 03-25-2014 02:09 AM

Or you can just copy file and thus take ownership. that way you can change permissions, assuming you have full permission on that file/folder or you are part of shared folder.

jpollard 03-25-2014 06:13 AM

Quote:

Originally Posted by mddesai (Post 5140725)
Or you can just copy file and thus take ownership. that way you can change permissions, assuming you have full permission on that file/folder or you are part of shared folder.

If you were able to copy the file, you had to have permissions on that folder.... :)

The reason the restriction is there is so that the original owner retains control of that specific file. If the OWNER chooses to grant world access that is his right. But it is not the right of a member of the group to do so.

Madhu Desai 03-25-2014 09:32 AM

Quote:

Originally Posted by jpollard (Post 5140816)
If you were able to copy the file, you had to have permissions on that folder.... :)

The reason the restriction is there is so that the original owner retains control of that specific file. If the OWNER chooses to grant world access that is his right. But it is not the right of a member of the group to do so.

You are right. But according OP, user is a part of the group which owns the file and has full permissions on it.

As admin i come across this very often, i.e., to create a shared folder for some employees so that they can collaborate their work in themselves. Usually those employees are programmers or atleast proficient in linux os. The only few restriction i'm supposed to make is that - they don't delete each-others file, they should not take ownership of that shared folder and other users should not be allowed in to that folder. Rest all should be permitted. Changing permission of file by taking ownership of that file (by copying) is one method they usually do.

I am not sure there is a concept of shared owners who can change ownership of file (excluding root). :scratch:


All times are GMT -5. The time now is 02:52 PM.