Using NFS to Share Files on Thecus 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

ThecusOS 6 on Thecus is a graphical web interface for easier management.

First, you need to browse available shared folders in [Control Panel] → [File Sharing/Privilege] → [Shared Folder]. Use [Add] button to create or select the folder you want to share via NFS.

Then click [NFS] button to bring up Config NFS Share dialog. Use [Add] tab to create a new exports or [Edit] button to edit existing export. You cannot change Host Name once created.

You may use IP with Netmask to specific range with the same permission. 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.

For OSX, choose AIX in OS Support. This will generate insecure as a parameter in exports which is a NFS configuration files. 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.

Here is an example configuration to export /NAS_Public on 192.168.2.* for OSX:

"/raid0/data/_NAS_NFS_Exports_/NAS_Public" 192.168.2.1/8(rw,fsid=2,no_root_squash,insecure,async,anonuid=99,anongid=99,no_subtree_check)

Last, choose root:root in ID Mapping. It’s easier for me to share among Linux, OSX, and Windows but less secured. Guest will have full access to this shared folder.

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 these configurations, folder owner created on Linux and OS X are different owner and groups. But files created on one can be edit or delete by another, because guest have full access.

drwxr-xr-x+ 2   1000 users   4096 Apr  2 00:25 Linux
drwxrwxrwx+ 2 nobody nogroup 4096 Apr  1 22:34 Mac

File Permission and Squash Option

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

Use exportfs -ra to reload export configuration as explained in Fix NFS privileges on Synology NAS on Linux and Unit tips. It’s the same to Synology DiskStation Manager. But you will have no right to remove anything created with no_root_squash, you may only read them.

drwxr-xr-x+ 2 nobody nogroup 4096 Apr  2 00:33 Linux
drwxr-xr-x+ 2 nobody nogroup 4096 Apr  2 00:33 Mac

Mount the Right Path

When your are in Config NFS Share dialog, you will see hint showing you how to mount the selected folder. Use NFS3 Mount point with Finder. You will see warning “You do not have permission to access this server.” if you use NFS4 Mount point.

How to Access a Shared Folder Locally with NFS on Thecus is a good step-by-step guide.

Here is an example to mount a shared folder NAS_Public at 192.168.1.116:

nfs://192.168.1.116/raid0/data/_NAS_NFS_Exports_/NAS_Public

Notes

This post only apply to ThecusOS 6. 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. Christian Schneider: HOWTO setup a small server: NFS Server (Network File System)
  6. Computer Hope: Netmask
  7. Facebook: QNAP Geek
  8. Krischan Jodies: IP Calculator
  9. Linux and Unix tips: Fix NFS privileges on Synology NAS
  10. Linux.org
  11. nfs.sourceforge.net: 3. Setting Up an NFS Server
  12. nfs.sourceforge.net: 8. Using Linux NFS with Other OSes
  13. QNAP
  14. QNAP: QTS
  15. Samba
  16. StackExchange: Unix & Linux: How to configure a fixed user ID on an NFS server?
  17. Synology: DiskStation Manager
  18. Tech Republic: Mounting NFS volumes in OS X
  19. Thecus
  20. Thecus: How to Access a Shared Folder Locally with NFS
  21. ThecusOS 6
  22. You Mac / Linux Guy: Automount NFS in OS X
  23. Wiki: Internet Protocol
  24. Wiki: Lightweight Directory Access Protocol
  25. Wiki: Network File System
  26. 鳥哥的 Linux 私房菜: 第十三章、檔案伺服器之一:NFS 伺服器
  27. 鳥哥的 Linux 私房菜: 何為同一網段之 IP ,及 netmask 的定義與切割子網的方法說明

Leave a comment

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