How to mark file as read-only when not owner of file
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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?
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...
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.
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.
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.
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).
Last edited by Madhu Desai; 03-25-2014 at 09:36 AM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.