Using NFS to Share Files on Asustor Between OS X and Linux


I choose to use Network File System aka NFS to share files between OS X and Linux because it’s much faster than Samba. But there is one more thing I need to handle: file and folder permissions.

Allow Connection to NAS

ADM on Asustor is a graphical web interface for easier management.

Before you begin to config, remember to enable NFS service in [Services] or some of the settings below won’t show up.

First, you need to check available shared folders in [Access Control] →[Shared Folders]. Use [Add] button to create or select the folder you want to share via NFS.

Then click [Access Rights] button to bring up Edit Shared Folder Privileges dialog. Use [NFS Privileges] tab to create a new or [Edit] button to edit existing shared folder. Remember to enable Allow connections from non-reserved ports (ports greater than 1024) which will generate insecure as a parameter in exports which is a NFS configuration file. According to Using Linux NFS with Other OSes on nfs.sourceforge.net, insecure will enable listening to ports higher than 1024. Because non-root users can bind ports above 1024, it’s less secured.

You may use IP with Netmask to specify range with the same permission in [Client Address*]. Thanks for correction by Li-chih Wu in Facebook Group: QNAP Geek.

For example, if you want all IP between 192.168.1.1 to 192.168.1.254 with the same permission, use 192.168.1.1/24. Another is all IP between 192.168.1.5 to 192.168.1.6 with the same permission, use 192.168.1.5/29. Netmask on Computer Hope is a very detail explain and IP Calculator by Krischan Jodies may calculate for you.

Last, choose root Mapping as root(0).

Here is an generated exports configuration to share a folder name Public on 192.168.2.*:

"/volume1/Public" 192.168.2.1/8(rw,async,no_root_squash,anonuid=0,anongid=0,subtree_check,no_wdelay,insecure)

Mounting NFS volumes in OS X on Tech Republic is a good post for first-time OS X user. Automount NFS in OS X from Your Mac / Linux Guy explains with Lightweight Directory Access Protocol aka LDAP.

With this configuration, folders created on Linux and OS X are different owner and groups. What’s created on OSX can be seen on Linux but no read nor write priviledge. For those created on LinuxOSX can see and read but not write.

root@AS5102T:/volume1/Public # ls -l
total 8
drwxr-xr-x    2 1000     users         4096 May  3 16:10 Linux/
drwxr-xr-x    2 501      20            4096 May  3 16:05 Mac/

File Permission and Squash Option

Because I want to have full access on files and folders on ADM, I have to edit /etc/exports and change no_root_squash into all_squash.

To apply this manual change, use exportfs -ra to reload export configuration as explained in Fix NFS privileges on Synology NAS on Linux and Unit tips. Or you may disable and then enable NFS service again in [Services] →[NFS].

If you login to ADM as admin instead or root, you will see error message running exportfs -ra. They are actually different users in ADM.

root@AS5102T:/volume1/Public # exportfs -ra
root@AS5102T:/volume1/Public # ls -l
total 8
drwxr-xr-x    2 admin    administ      4096 May  3 16:43 Linux/
drwxr-xr-x    2 admin    administ      4096 May  3 16:42 Mac/

admin@AS5102T:/volume1/Public $ exportfs -ra
exportfs: could not open /var/lib/nfs/.etab.lock for locking: errno 13 (Permission denied)
exportfs: can't lock /var/lib/nfs/etab for writing

Mount the Right Path

Here is an example to mount a shared folder Public at 192.168.1.10 with Finder:

nfs://192.168.1.10/Public

Notes

This post only apply to ADM. If you are using OS X as your NFS server, please refer to EXPORTS(5) on OS X Man Pages.

Reference

  1. About.com: Linux / Unix Command: exports
  2. Apple: OS X
  3. Apple: OS X Man Pages: EXPORTS(5)
  4. Apple: Support: Mac Basics: The Finder organizes all of your files
  5. Asustor
  6. Asustor ADM
  7. Christian Schneider: HOWTO setup a small server: NFS Server (Network File System)
  8. Computer Hope: Netmask
  9. Facebook: QNAP Geek
  10. Krischan Jodies: IP Calculator
  11. Linux and Unix tips: Fix NFS privileges on Synology NAS
  12. Linux.org
  13. nfs.sourceforge.net: 3. Setting Up an NFS Server
  14. nfs.sourceforge.net: 8. Using Linux NFS with Other OSes
  15. Samba
  16. StackExchange: Unix & Linux: How to configure a fixed user ID on an NFS server?
  17. Tech Republic: Mounting NFS volumes in OS X
  18. You Mac / Linux Guy: Automount NFS in OS X
  19. Wiki: Internet Protocol
  20. Wiki: Lightweight Directory Access Protocol
  21. Wiki: Network File System
  22. 鳥哥的 Linux 私房菜: 第十三章、檔案伺服器之一:NFS 伺服
  23. 鳥哥的 Linux 私房菜: 何為同一網段之 IP ,及 netmask 的定義與切割子網的方法說明

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.