1

I'm trying to change permissions of a file that my user does not directly own, but my user is in a group that does have ownership of the file.

Here are the current permissions of the file. I am logged in as user_a

-rwxrwx---. 1 user_b mygroup 145 Sep 28 15:53 /filepath 

I run the command chmod +x /filepath and I am met with the error:

chmod: changing permissions of '/filepath': Operation not permitted 

We have several users working on our linux computer, and we've all been added to mygroup. How can I make it so that we can change rwx permissions of each others files without using sudo?

2 Answers 2

3

Only root (i.e. UID 0) or a process with CAP_FOWNER can change the permissions of a file it does not own.

The most suitable approach is probably sudo.

Only root (i.e. UID 0) or a process with CAP_CHOWN can change the owner of a file.

4
  • So what you're telling me is that only root, and the current owner of the file can change permissions. Do I also have to be the owner in order to change ownership of the file? Commented Oct 6, 2017 at 21:25
  • @Michael Yes; that is more or less the same problem. Commented Oct 6, 2017 at 21:33
  • I see, guess I'll have to solve this in a different direction. Thank you! Commented Oct 6, 2017 at 21:43
  • @Michael did you find any way to solve your problem? I face the same issue. I want a user to change permissions on file/directory of which he is not owner but member of group owner. Chmod doesn't allow this. Thank you. Commented Apr 18, 2020 at 13:03
0

I think it's hilarious you can remove a file you don't own, but you can't change the permissions of it. The workaround solution would be to 1) copy the file somewhere, 2) delete the original, 3) move the copy back to the original location.

1
  • You could do that, but it wouldn't then be the original file. Also, bear in mind that the permissions that allow you to delete a file belong to its directory, not to the file. Commented May 17, 2021 at 21:03

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.