0
  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?

muru
  • 197,895
  • 55
  • 485
  • 740
Hao Liu
  • 19

3 Answers3

3

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.

Greg Bray
  • 286
  • 3
  • 10
0

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

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

0

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

ls -laF

and see what are permissions for . directory.

marosg
  • 1,303