Synology NAS Hacks
I’ve been using various Synology NAS devices for many years now, and they’re great. Well, almost. There are a few rough spots that don’t thrill me. These consumer-grade devices are designed to be difficult to break by people who know little about computers. This approach also annoys the living daylights out of people who do know a thing or two about network-attached storage.
Problem number one: manual configurations added via CLI disappear after reboot. I am talking about entries added to /etc/fstab
, /etc/exports
, and so on. The only viable option here is to recreate your changes after the system reboots. In other words, you need to create a script that runs at startup.
For example, I added the following line to /etc/fstab
that disappears after every reboot:
nas07.jedi.local:/downloads /mnt/nas07/downloads nfs defaults,bg,rsize=65536,wsize=16384 0 0
Very annoying. Yes, I can fiddle with the Web UI and mount this share the “right way,” but who has the time for this nonsense? A far better solution is to create a file called /etc/.fstab
and put your additions there. Then you would need to create a startup script that will append these lines to the actual /etc/fstab
every time the system boots.
cat << EOF > /usr/local/etc/rc.d/Sfstab.sh #!/bin/sh cat /etc/fstab /etc/.fstab > /tmp/fstab_tmp awk '/^ *$/ { delete x; }; !x[$0]++' /tmp/fstab_tmp > /etc/fstab /bin/rm -f /tmp/fstab_tmp mount -a EOF chmod 755 /usr/local/etc/rc.d/Sfstab.sh
You can use the startup script method to make any other change to your system that otherwise would not survive a reboot.
Problem number two: the Samba server refuses to follow symbolic links. This one is actually a “security feature.” There are reasons why disallowing soft links may be a good idea, but I don’t care.
The config file for Samba is /etc/samba/smb.conf
and you would need to add a few lines to the [global]
section of this file.
allow insecure wide links = yes follow symlinks = yes wide links = yes unix extensions = no
Once this is done, you will need to restart the SMB service:
/usr/syno/etc.defaults/rc.sysv/S80samba.sh restart
The change to /etc/samba/smb.conf
should still be there after you reboot the system. However, if that file somehow disappears or gets corrupted, the SMB service script will copy the default version from here: /etc.defaults/samba/smb.conf
I suggest you do not modify this default file, but instead do this:
/bin/cp -p /etc/samba/smb.conf /etc/samba/.smb.conf
Problem number three: standard Linux CLI utilities are missing. I should’ve started with this one, but here we are. The solution here is to add the Community Package Hub to your Synology Package Center:
- Open Synology Package Center → Settings → Package Sources → Add
- Add the source name CPHub and location http://www.cphub.net
- Close Settings and click Community → Easy Bootstrap Installer → Install
- Now, if you log out and log back in, you should have the
/opt/bin/ipkg
utility.
I suggest you now go ahead and install these tools:
ipkg update; ipkg install lsof util-linux moreutils psmisc