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
- About.com: Linux / Unix Command: exports
- Apple: OS X
- Apple: OS X Man Pages: EXPORTS(5)
- Apple: Support: Mac Basics: The Finder organizes all of your files
- Christian Schneider: HOWTO setup a small server: NFS Server (Network File System)
- Computer Hope: Netmask
- Facebook: QNAP Geek
- Krischan Jodies: IP Calculator
- Linux and Unix tips: Fix NFS privileges on Synology NAS
- Linux.org
- nfs.sourceforge.net: 3. Setting Up an NFS Server
- nfs.sourceforge.net: 8. Using Linux NFS with Other OSes
- QNAP
- QNAP: QTS
- Samba
- StackExchange: Unix & Linux: How to configure a fixed user ID on an NFS server?
- Synology: DiskStation Manager
- Tech Republic: Mounting NFS volumes in OS X
- Thecus
- Thecus: How to Access a Shared Folder Locally with NFS
- ThecusOS 6
- You Mac / Linux Guy: Automount NFS in OS X
- Wiki: Internet Protocol
- Wiki: Lightweight Directory Access Protocol
- Wiki: Network File System
- 鳥哥的 Linux 私房菜: 第十三章、檔案伺服器之一:NFS 伺服器
- 鳥哥的 Linux 私房菜: 何為同一網段之 IP ,及 netmask 的定義與切割子網的方法說明