New user, sftp issues


I’m trying out restic with my Synology NAS. It looks like the easiest way to set things up is to use SFTP. After setting up password-less login, my user has ownership and write permissions on /volume1/backups/restic-dest, but running restic init fails with

$ restic -r sftp:me@server:/volume1/backups/restic-dest/ init
create backend at sftp:me@server:/volume1/backups/restic-dest/ failed: mkdirAll(/volume1/backups/restic-dest/index): unable to create directories: mkdirAll(/volume1/backups/restic-dest): unable to create directories: mkdirAll(/volume1/backups): unable to create directories: mkdirAll(/volume1): unable to create directories: <nil>, sftp: "Permission denied" (SSH_FX_PERMISSION_DENIED), file does not exist, file does not exist, file does not exist

Looks like a permissions problem, but if I run

$ ssh me@server "mkdir /volume1/backups/restic-dest/index"

Then I can create the directory no problem.

Thanks for any help.

I remember that someone somewhere wrote that the sftp paths for Synology NAS are not the same as the paths you see after login with ssh.

You can use sftp me@server and then pwd to get the directory exposed via sftp, that tell you what the directory needs to be.

Please report back!

Confirmed on my Synology.

SSH puts you in your home directory but allows you access to the rest of the filesystem

$ ssh p4.lan
X11 forwarding request failed on channel 0
wscott@p4:~$ pwd
wscott@p4:~$ ls -d /volume1/crashplan

And sftp also puts you in your home directory, but in a chroot environment where that directory is at the root and you can’t leave.

$ sftp p4.lan
Connected to p4.lan.
sftp> pwd
Remote working directory: /
sftp> cd /volume1
Couldn't stat remote file: No such file or directory

That did it, shared volumes (and nothing else) are exposed under sftp. Thanks!

This specific Synology NAS behavior is now documented in the FAQ.