Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Mac OS X > mount NFS shares on Linux: uid and gid mystery

mount NFS shares on Linux: uid and gid mystery
Thread Tools
Senior User
Join Date: Nov 2002
Location: US
Status: Offline
Reply With Quote
Jan 17, 2003, 12:54 AM
 
I've been trying to figure this out: say on the Linux part I have this in my /etc/exports:

/home/foo my_powerbook(rw,all_squash,anonuid=501,
anongid=20,insecure)

and /home/foo has uid and gid:

uid: 500 (foo)
gid: 500 (foo) (it's a RedHat box)

and the permissions are -rw------- (or drwx------ for directories) all the way down.

Now on my PowerBook say the uid and gid are:

uid: 501 (foo)
gid: 20 (staff)


The /etc/exports listed above didn't work: I can't even peek inside the NFS share using root account. If I change that line into:

/home/foo my_powerbook(rw,all_squash,anonuid=500,
anongid=500,insecure)

I still can't see into the share using foo account on my PB, but I can cd into the share and see all stuff via root.


So I'm utterly confused now: I thought all_squash is to make all NFS shares be owned by anonuid and anongid, thus anonuid=501 and anongid=20 should've worked? (so I get the permission to see/change the stuff on my PB)


Any hint is EXTREMELY welcome!
     
Forum Regular
Join Date: Nov 2002
Location: Ottawa, Canada
Status: Offline
Reply With Quote
Jan 17, 2003, 01:00 AM
 
The easiest thing is to have the same UID/GID on both Linux & OS X. Not too hard to do. That's what I did. The thing that ticks me off is that I have to restart Finder after I log in because all files on the share are zero bytes in length (and zero free space) until then.
     
Mac Elite
Join Date: May 2001
Location: Earth
Status: Offline
Reply With Quote
Jan 17, 2003, 01:05 AM
 
How did you mount the disk?
If I remember corrrectly, you must have opts set with 'net' and '-P'. vsfstype should be nfs.
     
Senior User
Join Date: Nov 2002
Location: US
Status: Offline
Reply With Quote
Jan 17, 2003, 01:08 AM
 
I simply use cmd-k in Finder to mount the share. It's okay since on Linux I used 'insecure' option - I've done this successfully to other NFS shares on the Linux server (the difference though is that those shares all have world-wide readability so the exact uid and gid on OS X side doesn't matter).
     
Senior User
Join Date: Nov 2002
Location: US
Status: Offline
Reply With Quote
Jan 17, 2003, 01:11 AM
 
to thebunny: yup I thought about that too, but there got to be some more elegant way for this (translating uid and gid on the fly, but without requiring a full NIS running). And I'm sort of afraid that changing uid and gid to some non-standard #s would affect the forward compatibility (correct me if I'm wrong).
     
Forum Regular
Join Date: Nov 2002
Location: Ottawa, Canada
Status: Offline
Reply With Quote
Jan 17, 2003, 07:16 PM
 
OK, I was a bit tired yesterday and still am but I see two problems with your setup.

1.) /etc/exports on the RH box should definitely have anonuid=500, anongid=500. Those are the UID & GID remote requests are mapped to on the RH box (UID 501 might not even exist on your RH box and even if it does it has no access rights in /home/foo). You got that one already.

2.) You should do this on your directories:

chmod u+x /home/foo

/home/foo should look like this:

drwx------ 42 foo foo

Having the executable flag set on a directory means you can 'cd' into it (in geeky language: traverse it) - for a file it means you can execute it.

Sorry for not taking a closer look yesterday...
     
Senior User
Join Date: Nov 2002
Location: US
Status: Offline
Reply With Quote
Jan 17, 2003, 08:48 PM
 
Thanks thebunny - although it still didn't work. I changed /etc/exports on Linux side as you said, did a "service nfs restart", and actually /home/foo already has the right permission (drwx------). Tried to connect to the share - same: under foo on PowerBook I couldn't even peek into the share, but if I were the root, everything is fine.

I guess the problem is this: having anonuid and anongid as 500 in /etc/exports certainly allows my access on Linux side. But exactly because the share is 500.500, I can't access it on the Mac side (on Mac foo is 501.20).

How am I supposed to solve this dillema? But thanks anyway.
     
Forum Regular
Join Date: Nov 2002
Location: Ottawa, Canada
Status: Offline
Reply With Quote
Jan 17, 2003, 09:42 PM
 
LOL, true, both sides have to have the permission. Well this is what I did: I fired up the Netinfo, changed my UID (foo) to 500 (left the GID 20 and created a GID 20 on RH, added myself to GID 20 on RH). Then just run chown -R foo.staff /Users/foo. Logged out, logged back in and it was fine. I had the same user/group/UID/GID on RH & OS X. Problem solved. I always mount NFS as root from a startup script on OS X.

Good luck!
     
Mac Elite
Join Date: Sep 2000
Location: in front of the keyboard
Status: Offline
Reply With Quote
Jan 18, 2003, 12:00 AM
 
Originally posted by thebunny:
I always mount NFS as root from a startup script on OS X.

Good luck!
Why not just put it in NetInfo so it happens automatically?

Here is what I have:

/mounts/deuce:/home/photos
vstyp nfs
opts (-s, -b)
name deuce:/home/photos
dir /Network/Pictures


This way, my photo share on my Linux box (deuce) is mounted by my wifes and my computer at boot.
signatures are a waste of bandwidth
especially ones with political tripe in them.
     
   
Thread Tools
Forum Links
Forum 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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 08:19 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2