chmod if I am not root/file owner

6

If I am not the file' owner or root, can I use chmod to change the file permission?

Assume I have group/write access to the file, e.g. 775

Howard

Posted 2011-04-24T09:20:33.190

Reputation: 121

Related on [Unix.SE]: When does chmod fail?

– Palec – 2015-02-22T22:56:02.937

Answers

11

In a nutshell: No, you can't do that. Just for the plain reason that you could "steal" another user's file (related source):

Of course, only the owner of a file may use chmod to alter a file's permissions

There was another question on SO dealing with this here. The trick is to let chmod check if you're in the same group or have enough permissions in order to change that file's ownership and then run it as root.

slhck

Posted 2011-04-24T09:20:33.190

Reputation: 182 472

1

Basic answer is no, unless you have specific rights through the group you and the file is in.

Van

Posted 2011-04-24T09:20:33.190

Reputation: 31

Tell us more. If we are here, it's because we're interested in those specific rights. – djjeck – 2015-03-15T21:26:30.987