Prepare the NAS
Enable the SFTP service or WebDAV with HTTPS and create a dedicated user and folder. For the direct connection, the NAS needs a public address, for example via DynDNS and port forwarding. Without port forwarding, the NAS starts a reverse SSH tunnel.

