Set up NFS server on Fedora Core 5, OS X NFS Client
I recently bought a 750GB hard drive and installed it in my linux box running Fedora Core 5. Since I run my iTunes on my powerbook and have this big hard drive in my server I needed a way to add network access to the disk from OS X. I chose to setup the linux box as a NFS server and then use the built in network connector in Finder to connect to my drive.
How to setup NFS server on Fedora Core 5
With a very standard install of FC5 you should have all the nessesary deamons to run NFS. First you will need to edit the /etc/exports file. I know there is a way to do this with the GUI but a far better way to learn is to do it by hand. Before actually editing the file I’d do a man exports or check it out here as I am only going to include what I did when there are many other features that you may choose to use.
su
vi /etc/exports
add line of the form:
/path/to/shared/dir hostname/ip(options)
so that it looks like:
/mnt/tmp 192.168.0.4(rw,insecure,sync)
This tells the nfs server to allow 192.168.0.4 to both read and write to /mnt/tmp on the NFS server.
Now get it running
This will update NFS with changes made to /etc/exports:
exportfs -ra
This will restart NFS
/etc/init.d/nfs restart
Connecting with OS X
Simply go to finder select Go->Connect To Server… and enter NFS address in the form:
nfs://ip/dir
In our example that would look like:
nfs://192.168.0.4/mnt/tmp
Hit connect and you should be on!
Auto connect on boot
This page has a great description of all the options for connecting automatically in os x.
Troubleshooting
It actually took me a few days to get this working and I ran into a bunch of problems that no other site really made clear so I’m going to try to help.
- Check permissions of mounted directory. If using (rw) make sure that the directory is both readable and writable.
chmod 777 /mnt/tmp - For more security, use same UID’s for NFS server and client. I had to change my uid on my server to 501 to match my uid on my laptop. NFS will write the files using the uid of the client so if that user doesn’t exist on the server then you will see id numbers instead of usernames in directory listings.
- Use option insecure
(rw,insecure,sync). This piece of info was what held me up for a few days. Apparently when connecting from a mac you need to specify this option. - Finder says “cannont connect username or password is bad.” This is BULL! usernames and passwords are not used by NFS. There is something wrong with your /ect/export file
- Make sure the options immediately follow the hostname/ip like
192.168.0.4(rw)not192.168.0.4 (rw)
Do you store the music files on the network drive and access them through iTunes using NFS?
NFS will work with Windows (and others, see http://en.wikipedia.org/wiki/Network_File_System#Platforms) but SFU probably works better (http://en.wikipedia.org/wiki/Services_for_Unix).
Apparently it’s been awhile.. I was thinking of Samba…
I haven’t graduated yet
While windows does work with NFS using third party software I would suggest using samba on the linux server for true native windows file sharing between widows and linux. Get samba here: http://us4.samba.org/samba/
I love their slogan: “Opening windows to a wider world.”
Jon thank you for the help. This is exactly what I was looking for. I have a small problem however. I followed your instructions but when i try to connect to the nfs server from my macbook it just sits there idle.
I think that my error might come from the creation of the exports file. I used gedit to view it and it was empty. I added the line that you said, saved and closed it and followed the rest of the instructions/troubleshooting.
Let me know if you think of any other things.
Sincerely,
Matt
PS: I am using a linux machine that has fedora core 4 on it but I feel it should not matter.
I have exactly the same problem as Matthieu, and I don’t have any clue. Also Fedora 5 - Mac OS X 10.4.7. I tested all the obvious things, restarted the nfs server, matched the users IDs, changed permissions as far as possible (I can’t chmod 777 my external USB HD, the one I want to share, mounted under /media. It remains 755 all the time, maybe that’s the thing, but don’t know how to solve that…)
Hey guys, I ran into this very problem too. Click connect on the mac and it just hangs there. There are a few things your should check:
ping nfs.server.ipIf you still don’t have luck throw your exports file up here and I’ll take a look. The freezing is not an issue with your mac, it’s either the connection or the NFS setup.
Thanks for your quick reaction!
All your suggested tests passed.
My /etc/exports is simple:
/media/KAST 192.168.2.100(rw,sync,insecure)
Then I “exportfs -ra” and restart the nsf service.
I’ve also allowed 192.168.2.100 in /etc/hosts.allow
Still, when I do Go/Connect to server: nfs://192.168.2.110/media/KAST it keeps trying forever.
If I try it from a shell with
sudo mount -o -P 192.168.2.110:/media/KAST /mnt/KAST/
I get “NFS Portmap: RPC: Port mapper failure - RPC: Timed out”.
In my Fedora 5 laptop I check for rpcinfo -p and get, among others,
program vers proto port 100003 2 udp 2049 nfs 100003 3 udp 2049 nfs 100003 4 udp 2049 nfs 100003 2 tcp 2049 nfs 100003 3 tcp 2049 nfs 100003 4 tcp 2049 nfs
(Thus it is indeed running in an insecure port >1024).
I also tried sharing other directories, but that also fails.
Both computers are connected through a SMC7904BRA router in a local network, but the IP’s are always the same: ping, ssh and scp work fine in both directions!
It was the firewall! I had activated it during Fedora installation, so long ago that I did not remember it anymore… I found that just by deactivating it the connection went pretty OK, but then I also succeeded in opening just the necessary ports. For that I followed the instructions in http://www.linuxquestions.org/questions/showthread.php?t=294069. (Some ports need to be configured to become fixed, otherwise they will change after each nsf server restart).
Hi, I’m trying to get this working and I keep getting told by finder that “the name or password is not correct”.
My export file is this:
/media/Josh 192.168.1.101(rw,insecure,sync)
I then do an export -ra and restart nfs. I don;t get any errors on the server, just finder won’t connect.
Running FC8 and OSX 10.5