LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 03-24-2014, 07:06 AM   #1
tqz
Member
 
Registered: Jan 2008
Posts: 67

Rep: Reputation: 15
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.
 
Old 03-24-2014, 07:10 AM   #2
NotionCommotion
Member
 
Registered: Aug 2012
Posts: 687

Rep: Reputation: Disabled
I would think you could. What happens when you use chmod?
 
Old 03-24-2014, 07:12 AM   #3
jdkaye
LQ Guru
 
Registered: Dec 2008
Location: Westgate-on-Sea, Kent, UK
Distribution: Debian Testing Amd64
Posts: 5,464

Rep: Reputation: Disabled
You can use the chmod command to modify the permissions. Typing
Code:
man chmod
will explain how to do it.
jdk
 
Old 03-24-2014, 07:50 AM   #4
tqz
Member
 
Registered: Jan 2008
Posts: 67

Original Poster
Rep: Reputation: 15
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.
 
Old 03-24-2014, 08:14 AM   #5
NotionCommotion
Member
 
Registered: Aug 2012
Posts: 687

Rep: Reputation: Disabled
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.
 
Old 03-24-2014, 11:00 AM   #6
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,688

Rep: Reputation: 1259Reputation: 1259Reputation: 1259Reputation: 1259Reputation: 1259Reputation: 1259Reputation: 1259Reputation: 1259Reputation: 1259
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.
 
Old 03-25-2014, 02:09 AM   #7
mddnix
Member
 
Registered: Mar 2013
Distribution: Redhat, Ubuntu
Posts: 525

Rep: Reputation: 141Reputation: 141
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.
 
Old 03-25-2014, 06:13 AM   #8
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,688

Rep: Reputation: 1259Reputation: 1259Reputation: 1259Reputation: 1259Reputation: 1259Reputation: 1259Reputation: 1259Reputation: 1259Reputation: 1259
Quote:
Originally Posted by mddesai View Post
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.
 
Old 03-25-2014, 09:32 AM   #9
mddnix
Member
 
Registered: Mar 2013
Distribution: Redhat, Ubuntu
Posts: 525

Rep: Reputation: 141Reputation: 141
Quote:
Originally Posted by jpollard View Post
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 mddnix; 03-25-2014 at 09:36 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Owner of a directory different than file owner problems Guardian-Mage Linux - Server 4 04-24-2009 10:26 AM
Display by File Name, File Size, and File Owner using ls akeenabawa Linux - Newbie 9 08-15-2008 02:21 PM
File owner and File group locked - root deiphage Linux - Hardware 5 02-05-2005 01:30 PM
Getting the owner name of a file in C akin81 Programming 5 04-02-2004 03:36 PM
file permissions and file owner won't change Nadim Slackware 5 11-29-2003 06:03 PM


All times are GMT -5. The time now is 04:49 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration