Root cannot change file permission or ownership

chownnfs

My direcotrory is root:

pwd 
/

I have the following dir:

drwxrwxrwx   4 root   root     81920 Jun  4 09:25 imr_report_repo

NOTE: imr_report_repo is an NFS share.

Here is the fstab listing for imr_report_repo:

netapp1:/imr_report_repos_stage  /imr_report_repo  nfs   rw,bg,actimeo=0,nointr,vers=3,timeo=600,rsize=32768,wsize=32768,tcp 1    1
d imr_report_repo

A file within mount:

$ ls -al
-rw-r--r--  1 502     502      1273 Mar 21  2013 imr1_test.txt

The UID 502 does not exist. If we add that UID/GID locally:

$ groupadd -g 502 jimmy
$ useradd -g 502 -u 502 jimmy

It now shows up:

$ ls -al
-rw-r--r--  1 jimmy     jimmy      1273 Mar 21  2013 imr1_test.txt

Now change to root:

$ su -
$ chown oracle:oinstall imr1_test.txt
chown: changing ownership of `imr1_test.txt': Operation not permitted

Best Answer

Usually root does not have special permissions on NFS shares. On the contrary: root is mapped to an ordinary user (i.e. does not even have "normal" read and write access to root files).

You must run chown on the NFS server.

Related Question