User permissions in NFS mounted directory

nfs

I have oracle linux 6.7, a NFS server in Windows, and I am trying to mount a shared folder in Linux.

The Windows NFS server has a shared mount :

192.168.1.10:/OracleBK

In my oracle linux server, I created a folder , /orabackup and the oracle user from oinstall group is the owner of this folder :

mkdir /orabackup
chown -R oracle:oinstall /orabackup
chmod -R 777 /orabackup
mount -t nfs -o rw 192.168.1.10:/OracleBK /orabackup

The /etc/fstab corresponding line is

192.168.1.10:/OracleBK /orabackup nfs defaults 0 0

The command for mounting the folder used is :

mount /orabackup

Now , the "orabackup" folder is mounted .

However the oracle user cannot read and write, and needs read and write permissions to this directory. The root user can read and write.

What should be done to give full permissions to the oracle user ?

Best Answer

NFS checks access permissions against user ids (UIDs). The UID of the user on your local machine needs to match the UID of the owner of the files you are trying to access on the server.

I would suggest to go to the server and look at the file permissions. Which UID (find out with id username) do they belong to and which permissions are set?

And if you are the only one accessing the files on the server, you can make the server pretend that all request come from the proper UID. For that, NFS has the option all_squash. It tells the server to map all request to the anonymous user, specified by anonuid,anongid.

Add these options: all_squash,anonuid=1026,anongid=100 to the export in /etc/exports.

Be warned though, that this will make anyone mounting the export effectively the owner of those files.

Related Question