18

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 ?

Rui F Ribeiro
  • 56,709
  • 26
  • 150
  • 232
saeed.sh
  • 291

2 Answers2

19

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.

monsune
  • 507
2

You set the attributes on the mount point, and they don't count for much.  You need to do

chown -R oracle:oinstall /orabackup
chmod -R 777 /orabackup

again (as root) after mounting /orabackup, to set the attributes of the shared folder.

  • 1
    after mount , when i write chown -R oracle:oinstall /orabackup , this error is raised : [root@it ~]# chown -R oracle:oinstall /orabackup/ chown: changing ownership of `/orabackup/': Permission denied – saeed.sh Jan 02 '16 at 06:04
  • 1
    I agree with monsune: the fact that your NFS server is Windows-based complicates matters.  Can you look into the documentation of the NFS server software to see whether there is any way to change the ownership of the directory from the Windows box, and/or to allow the "root" user on the client to have full access to the shared folder? – G-Man Says 'Reinstate Monica' Jan 02 '16 at 06:23
  • root user can read and write on this directory . but i want to get permission to oracle user . – saeed.sh Jan 02 '16 at 06:34
  • My point is that, according to your previous comment, root doesn't have permission to do chown.  Maybe "full access" was the wrong way to phrase that; I meant "full rights" or "full privileges". – G-Man Says 'Reinstate Monica' Jan 02 '16 at 16:45