1. use root copy or create a file a.out
  2. chown user:user a.out, change a.out owner to user
  3. now change to user, su user
  4. use user to chmod a.out, chmod 755 a.out
  5. Ok, problem is here. step 4 will output : chmod: ./a.out: Operation not permitted

I run these step on SUSE, it's work. And chmod can use by file owner or root. So, i think this maybe a bug on Ubuntu. Anyone know this?

  • 2
    "So, i think this maybe a bug on Ubuntu." doubt it. More likely the directory above where you did this? Or immutable flag? Or ACL. – Rinzwind Oct 28 '16 at 7:24
  • 1
    Could not reproduce – muru Oct 28 '16 at 7:29

Check that the file is not set as immutable, as mentioned here:

Changing Ownership: "Operation not permitted" - even as root!

|improve this answer|||||

Make sure the current directory is write allowed for your user.

ls -laF

and see what are permissions for . directory.

|improve this answer|||||
  • . directory is user, but .. is root – Hao Liu Oct 28 '16 at 8:08
  • Can you post output of the command ? And also output of "lsattr a.out" – marosg Oct 28 '16 at 15:29

Check to see if the file is set as immutable.

root@hostname:/tmp# lsattr ./a.out
----i--------e-- a.out

That i means the file is immutable and cannot be changed. You have to use chattr -i ./a.out to clear the flag, and then +i to re-enable after making changes.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.