View Full Version : Permission Denied with NFS
daviddoria
21st August 2008, 02:31 PM
I added a folder to my /etc/exports (my machine is 192.168.0.2)
/etc/exports
/home/doriad/share 192.168.0.3(rw)
then I ran "exportfs -ra". I can connect to it fine from the other machine with
mkdir NetworkShare
sudo mount 192.168.0.2:/home/doriad/share NetworkShare/
I can see the contents of the folder, horray! However, I can't write to it even though I specified (rw). I read that this may have to do with the user name or uid not matching (which they indeed do not. the user on .0.2 is doriad and the user on .0.3 is dave).
How do I make it so I can write to the share in this situation?
Thanks,
Dave
daviddoria
25th August 2008, 11:05 PM
is this not possible?
lookzovt
26th August 2008, 02:04 PM
chmod a+rwx /home/doriad/share should give perrmision to all.
The problem can be also with selinux, but first try to give permission to the directory.
mattcen
27th August 2008, 02:48 PM
This (IMHO) is not a good idea! Nobody in their right mind should be giving every user on their system the ability to change their files (And I doubt that SELinux is to blame - I have the same problem as the OP and SELinux is set to permissive mode - effectively disabled)!
From my research I have determined that it is almost definitely a UID mismatch. Basically the reason for this is that the user you use on your server, has a different UID to the one on your client. Consequently, the client doesn't know that your user matches up with the user who is supposed to access those files. You need to be able to remap the UID so that the client can say "Oh, by this UID, you actually mean this username on my local system. I'll make adjustments for this to work". I have read a couple of suggestions on how to make this work, all of which have failed (on my Fedora 8 server).
This page (http://www.faqs.org/docs/linux_network/x-087-2-nfs.exports.html) mentions a couple of options you can set in your /etc/exports file to allow dynamic UID mapping (map_daemon, map_static, and map_nis). The first two of these options seem to be detected as a syntax error when I run 'exports -ra', and I haven't tried the third as I'm not running a NIS server. Below is what I interpret to be the correct syntax for each option:
/etc/exports:
/home 192.168.1.10(rw,map_daemon)
/home 192.168.2.10(rw,map_static=/etc/nfs/uids.map)
/etc/nfs/uids.map:
# Mapping for client:
# remote local
uid 1001 502 # guest
gid 1001 502 # guest
uid 1000 500 # admin
uid 1000 500 # admin
gid 4 10 # adm on remote, wheel on local
(Unfortunately I can't get that file to be correctly spaced in the post :S)
In your situation (with two different usernames, a fact that I just noticed after re-reading your post), I would create a common group on each machine (call it 'mygroup' for the sake of argument), and add both your user accounts on each system to 'mygroup', and then change the group ownership to 'mygroup' (using 'chgrp mygrp /home/doriad/share -R'), and the permissions to allow the group to write (if they currently cannot - 'chmod g+w /home/doriad/share -R'). This should theoretically allow both users to write to the directory without any issues.
So there's a starting point for you. I've been researching this on and off for a few months (a bit half-heartedly I must say - it's not exactly something I need done yesterday, and I've just been so busy!), and still come back to it on occasion. So you are a not alone!
I hope that you have better luck than me. Let me know if you find anything useful, and I shall do the same.
Good luck,
Matt
vBulletin® v3.8.7, Copyright ©2000-2013, vBulletin Solutions, Inc.