Link to home
Start Free TrialLog in
Avatar of mnis2008
mnis2008

asked on

NFS mount

I have an NFS server which is mounting /home onto another server. I am using NFS 4 to mount the FS

ON server
# cat /etc/exports
/exports        *(ro,sync,insecure,root_squash,no_subtree_check,fsid=0)
/exports/home   *(rw,nohide,sync,insecure,root_squash,no_subtree_check)

ON client
mount SERVER:/home -o soft -t nfs4 /home_new

I am able to mount fine. But I went ahead and created a file on the server in home
drwxr-x--- 2 root     root  4096 Apr 21 18:06 test

On the Client
home_new]# ls -ltr
total 0

I dont see the file, what might be the problem..
Avatar of farzanj
farzanj
Flag of Canada image

As I understand you can mount correctly.

In Server file : /etc/export
Comment the first line

Then do
service nfs restart


Then on client
service netfs restart

Then issue this command and show me the output
touch /home/a
Avatar of mnis2008
mnis2008

ASKER

The command hangs
which command hangs?

Make sure you are not accessing the mounted file systems while you are restarting the service.

Also make sure that the exported folder permissions on the server is also correct.
The touch command hangs I am still able to mount it.

On the server
# ls -l |grep home
drwxr-xr-x   4 root root  4096 Apr 21 18:06 home
here is the error


# touch a
touch: cannot touch `a': Permission denied
I figured out some thing, logging as root I am not able to write to the directories but as user I am able to write to those directories

That's the "root_squash" do:
The root user on clients that connect has the permissions of the user 'nfsnobody'.
How do I check it, I have root_squash defined in the exports.
Do u think the flags need to be modified in /etc/exports
- rw,nohide,sync,insecure,root_squash,no_subtree_check
NFSnobody exits on my server and client

Server - nfsnobody:x:4294967294:4294967294:Anonymous NFS User:/var/lib/nfs:/sbin/nologin

Client - nfsnobody:x:65534:65534:Anonymous NFS User:/var/lib/nfs:/sbin/nologin
Since in NFS /etc/exports has "root_squash" set,
so "root" on the client side will be treated as "nfsnobody".

So the permission on client /home
-----------
drwxr-xr-x   4 root root  4096 Apr 21 18:06 home
-----------
User "nfsnobody" has no permission to write. Unless you chmod o+rwx for /exports/home on NFS server
User "root" has no permission to write since root is "nfsnobody" for this nfs mount.
How do I give permissions to root
ASKER CERTIFIED SOLUTION
Avatar of wesly_chen
wesly_chen
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I just learnt that this is an insecure option, But I need this only till I copy some files to the share then I am going to remove the option and just use root_squash.

Thanks Chen