I’m trying to init my restic repo and I get this error:
sftp: “Permission denied” (SSH_FX_PERMISSION_DENIED)
i execute this: restic -r sftp firstname.lastname@example.org:/mountfolder init
/mountfolder is really a drive mounted on this remote box.
when I ssh or sftp directly I have no issues ie:
sftp usera@192. 168.8.8 - it allows me to create, list directories
ssh usera@192. 168.8.8 - allows me anything
I’m connecting to this box with ssh-keys so no password prompts.
This dir /mountfolder is owned by root but permissions are 777.
Even though I got error I found that some directory got created:
data index keys locks snapshots but all is empty.
Could you please help me figure this out? thx
Not sure if it matters but the /mountfolder is actually mount of luks2 encrypted drive.
restic -r sftp:email@example.com:/mountfolder (you have a space instead of a colon after
I have tested with colon as well and I get the same error.
Just to make sure tested more commands normal sftp connection:
mkdir, rename, rmdir - all of these works fine.
@jamesmason Please paste here the complete command line, with the command and all output. Please put it inside quotes, the “Preformatted text” button in the toolbar of this message editor. That way formatting doesn’t interfere with what you paste.
macos:/ localuser$ restic -r sftp:firstname.lastname@example.org:/home/usera/mnt init
Fatal: create repository at sftp:email@example.com:/home/usera/mnt failed: sftp: "Permission denied" (SSH_FX_PERMISSION_DENIED)
Above my complete command. I have also tried two scenarios where initially I mounted my drive in the root folder / and next I have mounted it in the home directory of the user but the error still the same.
This looks like a permissions issue at the destination.
Can you verify that if you run
sftp firstname.lastname@example.org:/home/usera/mnt from the command line, you are able to execute
put operations successfully within the
data etc. directories?
Yes i can execute all sftp commands that are available…create, remove directories etc…
At this point don’t even know anymore how to debug it. I didn’t mention that it is a raspberry pi 3b with raspbian not sure if there are any stem specyfic things to look for…?
I wonder if it’s trying to chmod the repository directory, which would be disallowed if it’s not owned by the same user. The repository should not be 777 anyway; make it owned by
usera and chmod 700.
I finally got it. One thing I didn’t mention is that the file system on my mounted drive is exfat and apparently to change ownership or permission you have to do it during mounting and not after.
So i unmounted drive and used this command if anyone needs it:
sudo mount -o rw,user,uid=1000,dmask=007,fmask=117 /dev/sdxn /mnt/sd1
Thanks for engaging @cdhowie and @rawtaz
Thanks for reporting back with a clear solution, so others can be helped!