After upgrading from Ubuntu v14.04 to v16.04 chown doesn't seem to work any longer on my server. I checked following:

  • filesystem is RW
  • user exists
  • folder is not immutable
  • all commands executed as root

and for the heck i tried following (as root):

$ id
uid=0(root) gid=0(root) groups=0(root)
$ apparmor_status
apparmor module is loaded.
0 profiles are loaded.
0 profiles are in enforce mode.
0 profiles are in complain mode.
0 processes have profiles defined.
0 processes are in enforce mode.
0 processes are in complain mode.
0 processes are unconfined but have a profile defined.
$ cd /
$ > test.txt
$ chmod 777 test.txt
$ lsattr test.txt 
-------------e-- test.txt
$ ls -l test.txt
-rwxrwxrwx 1 root root 0 Jun 27 19:01 test.txt
$ chown www-data test.txt
chown: changing ownership of 'test.txt': Operation not permitted

Anyone any suggestions?

  • As far as i know you cannot change the owner of a file to a user you have no access to. Or did you execute the chown as root? – Johan Jun 27 '16 at 17:27
  • 1
    Please check if you are root user. You can use id command to check the same. – satishwin Jun 27 '16 at 21:12
  • yes, it was executed as root and I even checked apparmor if there were any odd enforcing profiles loaded. (plz see question update for more clarification) – NoLdman Jun 28 '16 at 7:43

Your Answer

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

Browse other questions tagged or ask your own question.