Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Server
User Name
Linux - Server This forum is for the discussion of Linux Software used in a server related context.


  Search this Thread
Old 08-22-2012, 01:03 AM   #1
LQ Newbie
Registered: Nov 2009
Posts: 15

Rep: Reputation: 0
nfs all_squash and anonuid not working?

I have a shared storage disk mounted to Server A ( This shared storage is accessible only by one user in the "users" group. I want to mount this shared storage to Server B ( from Server A using nfs.

This is what I did:-
Server A
1. Edit the /etc/exportfs and added the following:-
The reason for suqashing is because as mentioned, only one user called "admin" can access the storage. However, the UIDs for admin in Server A and Server B is different so I'm squashing and mapping the UID in the nfs client to 900 so that "admin" in Server B can access the folder.

2. Reloaded the directories via "exportfs -vr" command

Server B
1. Created /etc/fstab entry as follow:-
Code: /ARCHIVE nfs defaults 0 0
2. Mount the drive as root
mount /ARCHIVE
3. Switch to "admin" user and attempt to access the directory /ARCHIVE
At this juncture, I get permission denied.

Any idea what I'm doing wrong?

I've googled all over and really not sure what's gone wrong since all the examples I've seen (and followed) is straightforward.

By the way, I'm using RHEL 5.2.

NOTE: I'm aware an easier alternative is to change the Server B "admin" user UID to be inline with Server A, but I'm trying to avoid that.
Old 08-22-2012, 02:13 PM   #2
Registered: Nov 2004
Location: San Bernardino, CA
Distribution: Gentoo, Arch, (RedHat4.x-9.x, FedoraCore 1.x-4.x, Debian Potato-Sarge, LFS 6.0, etc.)
Posts: 261

Rep: Reputation: 52

Well, taking a look at what you have there, let's start with the /etc/exports entry:
Now, does the UID 900 actually exist and is available on the Server A? If not, then change it to something that does exist on Server A that you consider "safe". That is what any new entries will appear to be from on Server A when accessed/written to across the mounted share, which with all_squash is what everything will appear to be.

Also, an example of a couple additional entries in the /etc/exports file that have helped me out in the past:
/mnt/repository         192.168.2.*(sync,rw,all_squash,anonuid=500,anongid=500,no_subtree_check)
Now, if you are doing 'ro', then I imagine you don't *need* sync, but you will likely get a warning message if you don't put something. The 'no_subtree_check' will, at the very least, make the mounting of the shared directory faster since it won't require NFS to check the entire filesystem before completing the mount.

Now, on the other side, let's look at the /etc/fstab entry of Server B:
Code: /ARCHIVE nfs defaults 0 0
Well, I have never been one for blind "default" settings, so let me show you an example of one of the mounts of one of our servers:
Code:   /mnt/mirror nfs rw,sync,bg,auto,intr,soft,retry=10
So, I have it that it is readable and writable, that changes must make it to disk before next request is serviced, that the mounting process is left in the background, that the mounting is done automatically when the filesystems in the fstab are processed on boot/startup, that the mounting process is interruptible (should there be an issue with the mounting), and that the mounting client will fail if there isn't success in the 10 minutes of retries.

Also, you don't need the filesystem check settings (e.g. "0 0") at the end of Server B's fstab entry as that should be handled by Server A to begin with.

HTH. Let us know.

Last edited by ShadowCat8; 08-22-2012 at 03:07 PM. Reason: Corrections after proofreading
Old 08-23-2012, 02:52 AM   #3
LQ Newbie
Registered: Nov 2009
Posts: 15

Original Poster
Rep: Reputation: 0
Originally Posted by ShadowCat8 View Post
Now, does the UID 900 actually exist and is available on the Server A?
I didn't know this! I had thought (misunderstood rather) that the usage of anonuid will just 'map' the current UID ownership of the folder to the specified anonuid at the remote machine, without needing an actual user in the local machine with that UID. Anyway, I've created a user with the UID 900 in the local machine.

I reloaded the /etc/exports. Note that my /etc/exports is still the same as before.

In Server B, I updated the /etc/fstab as follow:-
Code: /ARCHIVE nfs ro,bg,auto,intr,soft,retry=10
I did a remount of the folder.

Unfortunately, the ownership is still set as seen in Server A. As such, the "admin" user in Server B (UID=900) is unable to access the folder, whose ownership still belongs to UID=510 (as per Server A). By the way, the folder is set to Owner-only access i.e. 700.

Is there any logs I can and should be looking at?
Old 08-23-2012, 10:12 PM   #4
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 681Reputation: 681Reputation: 681Reputation: 681Reputation: 681Reputation: 681
Moved: This thread is more suitable in Linux Server and has been moved accordingly to help your thread/question get the exposure it deserves.
Old 08-24-2012, 11:52 AM   #5
Senior Member
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 15.2
Posts: 1,339

Rep: Reputation: 260Reputation: 260Reputation: 260
And on Server A the local UID=900 can access the data?


nfs, nfs exports, rhel5, rhel52

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
NFS not working.Please help gardenair Linux - Newbie 19 05-07-2010 07:51 AM
NFS not working methodtwo Linux - Networking 3 05-09-2008 11:20 PM
nfs is not working nehra13 Linux - Networking 7 01-22-2008 01:15 PM
NFS share not working ahmedb72 Red Hat 3 02-22-2006 02:38 AM
nfs: all_squash vs. squash_uids/squash_gids Janger Linux - Networking 0 01-28-2005 06:48 AM > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 12:16 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration