Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 676
  • Last Modified:

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..
0
mnis2008
Asked:
mnis2008
  • 10
  • 4
  • 2
1 Solution
 
farzanjCommented:
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
0
 
mnis2008Author Commented:
The command hangs
0
 
mnis2008Author Commented:
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
farzanjCommented:
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.
0
 
mnis2008Author Commented:
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
0
 
mnis2008Author Commented:
here is the error


# touch a
touch: cannot touch `a': Permission denied
0
 
mnis2008Author Commented:
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

0
 
wesly_chenCommented:
That's the "root_squash" do:
The root user on clients that connect has the permissions of the user 'nfsnobody'.
0
 
mnis2008Author Commented:
How do I check it, I have root_squash defined in the exports.
0
 
mnis2008Author Commented:
Do u think the flags need to be modified in /etc/exports
- rw,nohide,sync,insecure,root_squash,no_subtree_check
0
 
mnis2008Author Commented:
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
0
 
wesly_chenCommented:
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
0
 
wesly_chenCommented:
User "root" has no permission to write since root is "nfsnobody" for this nfs mount.
0
 
mnis2008Author Commented:
How do I give permissions to root
0
 
wesly_chenCommented:
> How do I give permissions to root
Q1. Do you need it?
Q2. Do you need to map to UID 0?

If both yes, then on NFS server,
change in /etc/exports
/exports/home   *(rw,nohide,sync,insecure,no_root_squash,no_subtree_check)

and restart nfs daemon

If Q2 is not needed, then do (on NFS server)
chmod o+rw /exports/home/<directories you want root on client to write>
0
 
mnis2008Author Commented:
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
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 10
  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now