A Dropshare community user has figured out a way how to use Dropshare with a Synology NAS, and wants to share his experience with you.
Once you have set up your ssh and sftp server as well as port forwarding, go to the error messages paragraph and fix the SFTP protocol error.
If you have spent the past 24hours trying to figure out, how to set up Dropshare 4 with your Synology Diskstation - don't fear! I finally managed to do it, even though it took way too long and was frustrating as hell. In this "tutorial" I will go through all the errors I had, how I managed to fix them and show you what the cleanest solution is. I am by no means an expert and maybe the errors just appeared to me. I only have one Synology DS415+ and so I cannot test it on a different device but please feel free to comment and tell us how you managed to fix it (if there are any Synology users trying to use Dropshare with their NAS).
For this tutorial you will need to be more or less an advanced user. I will not be able to show you every single instruction, so please make sure you are confident with the following:
- Installing apps from the Synology Package Center (shouldn't be hard)
- Forwarding ports on your Router
- Accessing your Synology using SSH and the Terminal App
- Gaining Root access using SSH and understanding the risks involved
- Some basic shell knowledge You can always ask questions when you don't understand something. However, let Google be your best friend.
The Main setup
Before we start fighting with annoying error messages, let's go through the main setup which theoretically should work out of the box but simply doesn't.
Configure your DynDNS
This would be faar too much for this (relatively) long tutorial - please check google for help. What you will want to have, is a nice static IP address. I do recommend using No-Ip.com as they offer a free ddns service that you will need to log into every 30 days. But you can use whatever you want. For this tutorial we will assume that I am using offcorner.ddns.net
Configuring Web Station
First we will need to set up our Web Station in order to access our files from the internet without a password whatsoever. In order to do this, login to your Synology (using its IP Address and adding :5000 at the end. Or by going to find.synology.com however that doesn't always work for me). Next, open the Package center and install the Web Station package. After that, open the Web Station and make sure that "Enable personal website" is checked. (you could go without, but only do this if you are an advanced user).
Set up SSH and SFTP
Synology offers users to enable or disable SSH and SFTP separately. In order to use Dropshare, we will need to enable both and set them to run at the same port. Port 22 is set by default, however I would highly suggest to edit that port to some random number like 4988. This will increase the security of your NAS and your files. Go to your Synology via the web interface and open Control Panel > File Services > FTP. Then scroll down and enable SFTP. Set the port to your own custom number. Next up, go to Control Panel > Terminal & SNMP and enable SSH Service. Again, set the port number to your custom port number. You can check if everything is working by opening the Terminal on your mac and entering ssh -p port_number [email protected] and replacing port_number with your port number, username with your username and ip-address with the local ip address.
Forward your ports
Go to your Router (this will depend on the device that you are using - I won't be able to give specific information for every device out there... And forward port 80 and your custom SSH/SFTP port to your Synology's internal IP-Adress. By now you should be able to upload a file (let's use image.jpg as an example) to your home>www directory and access it from outside the web by entering offcornerdev.ddns.net/~username/image.jpg
Set up Dropshare
I created a directory in home>www called Dropshare and I will use that as my home directory for Dropshare. You could use whatever directory you want. Now open up Dropshare prefererences > connections and add a SCP over SSH Connection. For hostname enter: offcornder.ddns.net:4988 (replace the address and the port with your own) in user and password you enter your synology username & password. You could use an SSH Key Pair etc. For Save files at enter: www/dropshare (replace *username* and make sure you have created a Dropshare directory in your home>www folder) for URL to path enter: http://offcorner.ddns.net/~username/dropshare/ (Do NOT forget the tilde ~ sign!)
Test your connection: you are not done yet :tired_face:
Right now, "test your connection" should give you a success message and the link should work. But don't be too proud of yourself yet! (By the way, if you receive an error: make sure everything is entered correctly and that you can access your external address. You might encounter a NAT loopback error while trying to access the ddns address while being connected to your home wifi. One way to fix this would be to edit your /etc/hosts file... but then you wouldn't have access when from outside your wifi. If you only want to test things, either make a hotspot or use your local ip to the synology instead of the ddns ip). Once you try to upload a file, you will get one of the following errors:
SFTP subsystem could not be loaded
To fix this error, make sure you have both, SSH and SFTP enabled on exactly the same port and that you have entered that very port in the hostname field in Dropshare.
SFTP Protocol error
This is an annoying error and it took me a good while to fix it. If you are tired of reading, skip over the next paragraph.
Analysing the SFTP Protocol error
By the time I faced this error I was completely done and wanted to uninstall Dropshare. I spent hours googling and trying to find an answer but to no avail. Eventually I SSHd into the synology and tried to read the log messages. This requires root acces. How to do it? It's simple once you know it... sudo -i (enter your synology password) cat /var/log/messages this will display a massive log - don't worry! Scroll down to the very bottom and you will find something similar to: Aug 12 09:14:27 Synology internal-sftp: sftp-synolib.c:107 not found share [www] What does that mean? It seems like Dropshare is using ssh when testing the connection but then switches over to SFTP when creating the folder where the file should be uploaded. Then, it switches over to scp to upload the file to the created directory. The problem is, that the sftp protocol is looking for a shared folder called www. We do not want to use any shared folder called www but rather our www folder inside the home directory. (Please note that I have also tried entering the absolute path (volume1/homes/username/www) but that doesn't really yield a better result.
FIXING the SFTP Protocol error
First, create a shared folder named www in Synology Control Panel > Shared folders. It should be in volume1 and your username should have full access to it. You check "hide in my network places" and "hide from other users..." as this will be more of a dummy folder. Next, connect to your Synology over SSH. Use sudo -i to gain root access and enter cd /volume1/www We are now in the shared folder we just created. Now we will create a symbolic link to our Dropshare folder using ln -s /volume1/homes/username/www/dropshare dropshare enter ls and you should see a folder named dropshare. That's it! you can try uploading a file using Dropshare and it should just work - horray!
This setup took really longer than I had hoped for. I believe it is rather Synology's fault, but maybe it is Dropshare not using the correct path when creating the folder? I do not have an answer. Please let me know if this was useful - I am very curious to know how many people are using Dropshare together with their NAS.