We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

NFS mount

mnis2008
mnis2008 asked
on
Medium Priority
717 Views
Last Modified: 2012-05-11
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..
Comment
Watch Question

CERTIFIED EXPERT

Commented:
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

Author

Commented:
The command hangs
CERTIFIED EXPERT

Commented:
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.

Author

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

Author

Commented:
here is the error


# touch a
touch: cannot touch `a': Permission denied

Author

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

Top Expert 2011

Commented:
That's the "root_squash" do:
The root user on clients that connect has the permissions of the user 'nfsnobody'.

Author

Commented:
How do I check it, I have root_squash defined in the exports.

Author

Commented:
Do u think the flags need to be modified in /etc/exports
- rw,nohide,sync,insecure,root_squash,no_subtree_check

Author

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
Top Expert 2011

Commented:
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
Top Expert 2011

Commented:
User "root" has no permission to write since root is "nfsnobody" for this nfs mount.

Author

Commented:
How do I give permissions to root
Top Expert 2011
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

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
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.