Linux: Can't change file permissions being in the same group as the file

5

So I have a file:

-rw-rw-rw- 1 joe web 35046982 Nov  4 16:54 app.log

I am in web group:

[sam@proj log]$ id
uid=5067(sam) gid=5071(sam) groups=505(web),5071(sam)

But I can't change the permissions:

[sam@proj log]$ chmod 777 app.log 
chmod: changing permissions of `app.log': Operation not permitted

More background:

This is for a deployment script. Many users can run it with their own user and they all need to be able to do stuff like adding write permissions to log file. I thought assigning the file to a group and then adding all users to that group would work.

What am I doing wrong?

Pawel Decowski

Posted 2009-11-04T17:09:51.480

Reputation:

Answers

6

Only privileged users (root) can chown a file. At most, if you're the owner of the file you can change its group with chgrp.

From the chown man page

Only the root user can change the owner of a file. You can change the group of a file only if you are a root user or if you own the file. If you own the file but are not a root user, you can change the group only to a group of which you are a member.

Mereghost

Posted 2009-11-04T17:09:51.480

Reputation: 592

The topic started had issue with chmod actually. – antongorodezkiy – 2017-09-05T22:28:03.883

5

I think that only privileged users can change permission of files that doesn't belong to them. In your case, you are not joe and you are not a privileged user, so you can't change file permissions.

danadam

Posted 2009-11-04T17:09:51.480

Reputation: 375

What does "privileged user" mean? – None – 2009-11-04T17:28:41.707

1It means a user which can do anything on the system, root for example. – danadam – 2009-11-04T17:45:24.247

1

What filesystem is this on? Is this a network share? is this on NFS? Im guessing its on NFS, so chekc your export options and make sure you're exporting with full permissions to that group id...

J Sidhu

Posted 2009-11-04T17:09:51.480

Reputation: 606

It's ext3. What are "export options" and how do I export with full permissions to a group ID? – None – 2009-11-04T17:31:07.863

1

The export options Sidhu is referring to are NFS(http://en.wikipedia.org/wiki/Network_file_system) export options. The only way I know of to export full permissions are to give it full permissions on the host.

– Kevin M – 2009-11-04T18:00:31.050