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

DSM on Synology is a graphical web interface for easier management.

First, you need to add IP address in NFS Privileges list in [Control Panel] → [File Sharing and Privileges] → [Shared Folder] and allow for read / write. 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.

You also need to enable [Allow connections from non-priviledged ports (ports higher than 1024)] for OS X.

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.

At first, I leave Root squash as default No mapping. But I notice folder owner created on Linux and OS X are different, files created on one cannot be edit or delete by another.

drwxr-xr-x    2 1000     users         4096 Nov 14 10:33 Linux
drwxr-xr-x   13 501      20            4096 Nov 14 10:30 Mac

File Permission and Squash Option

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

Use exportfs -ra to reload export configuration or use /usr/syno/etc/rc.d/S83nfsd.sh restart to restart NFS service. Please refer to Fix NFS privileges on Synology NAS on Linux and Unit tips and Basic commands to get around the Synology Box using the CLI: nfs on Synology for more detail.

In export, anonuid=1025 will be map as guest while anonuid=1024 is admin.

drwxr-xr-x    2 admin    users         4096 Nov 14 19:15 Linux
drwxr-xr-x    2 admin    users         4096 Nov 14 19:20 Mac

Stop Generating @eaDir

When I am copying files, it seems @eaDir will stop from copying due to permission as discussed in eaDir directories causing problems on Synology forum. Therefore, I follow Getting rid of the @eaDir folders on Synology NAS DSM on MikeBeach.org to delete them all.

find . -name "@eaDir" -type d -print0 | xargs -0 rm -rf

Because I don’t need its Media Indexing Services, I also follow Disable indexing and generation of @eaDir directories on Synology NAS on MikeBeach.org to disable it.

cd /usr/syno/etc.defaults/rc.d/
chmod 000 S66fileindexd.sh S66synoindexd.sh S77synomkthumbd.sh S88synomkflvd.sh S99iTunes.sh

Notes

This post only apply to DSM on Synology. QTS on QNAP is even easier.  Please refer to Using NFS to Share Files on QNAP Between OS X and Linux. 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 Man Pages: EXPORTS(5)
  3. Apple: OS X
  4. Christian Schneider: HOWTO setup a small server: NFS Server (Network File System)
  5. Computer Hope: Netmask
  6. Facebook: QNAP Geek
  7. Krischan Jodies: IP Calculator
  8. Linux.org
  9. Linux and Unix tips: Fix NFS privileges on Synology NAS
  10. MikeBeach.org: Disable indexing and generation of @eaDir directories on Synology NAS
  11. MikeBeach.org: Getting rid of the @eaDir folders on Synology NAS DSM
  12. nfs.sourceforge.net: 3. Setting Up an NFS Server
  13. QNAP
  14. QNAP: QTS
  15. Samba
  16. StackExchange: Unix & Linux: How to configure a fixed user ID on an NFS server?
  17. Synology
  18. Synology: DiskStation Manager
  19. Synology: Basic commands to get around the Synology Box using the CLI: nfs
  20. Tech Republic: Mounting NFS volumes in OS X
  21. Synology: Forum: eaDir directories causing problems
  22. Using NFS to Share Files on QNAP Between OS X and Linux
  23. Wiki: Internet Protocol
  24. Wiki: Lightweight Directory Access Protocol
  25. Wiki: Network File System
  26. You Mac / Linux Guy: Automount NFS in OS X
  27. 鳥哥的 Linux 私房菜: 第十三章、檔案伺服器之一:NFS 伺服器
  28. 鳥哥的 Linux 私房菜: 何為同一網段之 IP ,及 netmask 的定義與切割子網的方法說明

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s