Chown operation not permitted for root

Solution 1:

The immutable attribute might be set on the file. Remove it with

chattr -i <file>

Solution 2:

Several solution exists, some among them:

  • you have a filesystem does not lets you eg. uid:gid, eg: FAT
  • the drive has been mounted read-only
  • SELinux or other security enforcers apply
  • filesystem is set to read-only mode (xfs_freeze, for example)
  • file has the immutable flag set (man chattr)

Solution 3:

Funny. Did you check the system logs (/var/log/messages, /var/log/syslog, output of dmesg) for any clues?

Possible reasons:

  • You are running some security-enhanced Linux, such as SELinux. These place restrictions even on what root can do.
  • The file is on a file system that does not support file ownership, such as (V)FAT. Depending on mount options chmod/chown will give you errors.

Solution 4:

Try this:

[root@ root]# chattr -ais /bin/ls

after changing the ownership and group back to root.


Solution 5:

I had same problem.

$ chattr -V -i dir
chattr 1.41.12 (17-May-2010)
Flags of dir set as s----a---------

Which was not enough. So i added the 'sa'

$ chattr -V -ais dir
chattr 1.41.12 (17-May-2010)
Flags of dir set as ---------------
$ chown root dir
$

Problem solved :)