I try to chown the owner of a file to root, but I can't. I'm doing this as root. I get the following message:
chown: changing ownership of `ps': Operation not permitted
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.Sign up to join this community
The immutable attribute may be set on the file. Remove it with chattr -i
Several solution exists, some among them:
Funny. Did you check the system logs (/var/log/messages, /var/log/syslog, output of dmesg) for any clues?
[root@ root]# chattr -ais /bin/ls
after changing the ownership and group back to root.
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 :)
on what kind of Filesystem is the "ps" file you are trying to chown ? Is the fs mounted as ro (readonly) ?
if you are talking about /bin/ps, on debian it's always like:
-rwxr-xr-x 1 root root 76132 2009-05-28 10:48 /bin/ps*
Every "guess" made by other answers is possible. A debugging hint may be to do a strace of the command, and look into the output in order to see what is the real problem in the syscalls itself.
strace chown root /bin/ps 2>&1 | less