+++ title = 'Synology NAS: NFS shares' aliases = '/posts/2023-04-10-synology-nas-nfs-shares' summary = '''I've done this setup now several times (because I break so many things all the time). It is time to write it down...''' date = '2023-04-10T21:44:18+0200' # lastmod = '' categories = [ 'computerstuff' ] tags = [ 'linux', 'server', 'nfs', 'networking' ] # showDate = false # showReadingTime = false # showWordCount = false # showPagination = false # feed_exclude = true # site_exclude = true +++ ## Create or change the NFS share First of all edit your shared folder. <kbd>Control Panel</kbd> → <kbd>Shared Folder</kbd> → <kbd>Edit</kbd> → <kbd>NFS Permissions</kbd> → <kbd>Create (or Edit)</kbd>.  | Setting | Value | | :------------- | :------------------------- | | Hostname or IP | 192.168.10.100 (actual IP) | | Privilege | Read/Write | | Squash | Map all users to admin | | Security | sys | ## Change the user and group ids in `/etc/exports` Now login to the <abbr title="Network Attached Storage">NAS</abbr> with <abbr title="Secure Shell">SSH</abbr> and open the file `/etc/exports` as the user root. The file should look similar to this one: ``` /volume1/video 192.168.10.100(rw,async,no_wdelay,crossmnt,insecure,all_squash,insecure_locks,sec=sys,anonuid=1026,anongid=100) ``` I have the following users on my NAS: ``` uid=1024(admin) gid=100(users) groups=100(users),101(administrators) uid=1026(dominic) gid=100(users) groups=100(users),101(administrators),1000(nfs-dominic) uid=1000(nfs-dominic) gid=1000(nfs-dominic) groups=1000(nfs-dominic) ``` Change the parts `anonuid=1026,anongid=100` to your needs. I do have a personal folder that I change to `anonuid=1000,anongid=1000` but I leave others (like video) that use `anonuid=1026,anongid=100` (because I want the internal user on the NAS to use them too). ## Restart NFS Service on your NAS Whenever you finished your changes to that file, save it and go back to the control panel on the web interface. <kbd>Control Panel</kbd> → <kbd>File Services</kbd> → <kbd>NFS</kbd>. 1. Disable NFS service, click <kbd>Apply</kbd>. 2. Enable NFS service, click <kbd>Apply</kbd>. ## Adopt your client Edit your `fstab` file. Mine looks like this: ``` nas.lan:/volume1/video /home/dominic/_nas/video nfs noauto,users,nodev,async,soft,_netdev,x-systemd.device-timeout=1,x-systemd-idle-timeout=1min,x-systemd.mount-timeout=10,timeo=10,retry=3 0 0 ```