Score:0

Issues enabling NFS from Ubuntu Server to macOS

cl flag

I'm relatively new to all this and appreciate the help.

I'm trying to access my Linux server /home directory from macOS via NFS. I've taken the below steps, but macOS Finder is unable to connect to the server.

Error message: There was a problem connecting to the server “192.168.86.114”. The server may not exist or it is unavailable at this time. Check the server name or IP address, check your network connection and then try again.

On the host (Ubuntu 20.04 LTS):

  1. Installed nfs-kernel-server
  2. Edited /etc/exports to include: /home [client_ip](rw,sync,no_root_squash,no_subtree_check)
  3. Exported the NFS share directory (sudo exportfs -a) and restarted the NFS kernel server (sudo systemctl restart nfs-kernel-server)
  4. Allowed NFS access through the firewall (confirmed allowed access from [client_ip] on port 2049)

On the client (macOS Monterey 12.0.1)

  1. Finder -> Connect to Server -> nfs://[host_ip]/home

I have a Google Nest Wifi router.

Have I missed anything? Ultimately I'd like to set this up to mount on login.

Thanks in advance!

(cross-post: https://apple.stackexchange.com/questions/432003/issues-enabling-nfs-from-ubuntu-server-to-macos)

in flag
Are you hosting the entire `/home` directory? Or just `/home/{user}`? If it's the entire home directory, you will want to confirm that the permissions are correct, as it's owned by `root:root` by default
Terrance avatar
id flag
Hmmmm no idea on the Go -> Connect to Server as I have tried just about everything on that one. I have been able to add my network to the `/etc/hosts.allow` file as `rpcbind : 10.0.0.0/24 127.0.0.1` on my NFS server and restart my rpcbind service `systemctl start rpc-statd` then and only then I was able to mount through the Mac terminal by the `mount_nfs` command. Then the connect to server line worked as long as I had the NFS mount connected.
Terrance avatar
id flag
Oh, my mount command was `sudo mount_nfs -o resvport 10.0.0.220:/media/storage NFS/`
maesterdaemon avatar
cl flag
@matigo good point, thanks - I've changed the **/etc/exports** line to refer to **/home/[user]** and refreshed everything... unfortunately still unable to access via macOS Finder.
Terrance avatar
id flag
I have 2 Macbook Pros here. One is my personal and one is my work. I cannot type in `nfs://10.0.0.220/media/storage` in my Connect to Server or Command+K box to connect to my NFS shares. However, I can connect if I browse to my Samba shares on the exact same server that is running my NFS shares. Command line I can connect up just fine and mount my NFS shares in iTerm on the Mac. I believe that this is because when using the connect to server it is not a complete command to mount the share onto your system, where with the Samba browse, it mounts when you double-click the share.
Terrance avatar
id flag
This appears to be a Mac OS X issue and not an Ubuntu issue.
maesterdaemon avatar
cl flag
Thanks @Terrance, and sorry for the delayed reply. I attempted to mount the Ubuntu NFS via MacOS terminal (i.e. via 'sudo mount_nfs' and 'sudo mount'), but unfortunately this hasn't worked either. Terminal just hangs and I have to CTRL-C out. Very strange, not sure where to go from here - other than to just bail and try via SMB?
Terrance avatar
id flag
@maesterdaemon Did you perform the other steps I did before I ran the mount command in the comment above that? Those steps I performed on my Ubuntu system that is hosting the NFS mount point, just make sure you change the IP addresses to match your network. Yes, wtih SMB I had no issues at all using the Connect to Server box on the Mac.
maesterdaemon avatar
cl flag
Thanks @Terrance. Yes I added to hosts.allow and restarted the rpcbind service before attempting to mount via macOS terminal - unfortunately it didn't work. I've also tried to set up an SMB share (via this [guide](https://linuxconfig.org/how-to-configure-samba-server-share-on-ubuntu-20-04-focal-fossa-linux) and others), and I'm not able to access my server via SMB either... Not sure if there may be an overarching problem. My server is successfully accessing my NAS via NFS. Just the other way around that I haven't been able to set up.
Score:0
cl flag

After spending some time away from this I found a solution here which did the trick.

Turns out to enable nfs access from macOS, I needed to:

  1. Set the 'insecure', 'all-squash', 'anonuid' and 'anongid' options in the /etc/exports file
  2. Use the full 'nfs://[server-IP]/home/[user]' path in Finder's Connect to Server

Thanks for all your help in troubleshooting this!

Panayotis avatar
cn flag
For me, adding 'insecure' was enough. Thank you for the tips!
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.