Filebrowser as a remote backup location: folder permissions, SSH and rsync

My YunoHost server

Hardware: Raspberry Pi 3, at home
YunoHost version: 11.0.11
I have access to my server : Through SSH and through the webadmin
Are you in a special context or did you perform some particular tweaking on your YunoHost instance ? : no
If your request is related to an app, specify its name and version: filebrowser 2.23.0~ynh2

Description of my issue

Hello :slight_smile:

I use Filebrowser (v.2.23.0~ynh2) and I want to use it as a backup location for files on my laptop.

Rather than sign into it via a web browser every time and organise everything by hand, I thought I’d use rsync’s SSH capability to sync the files across to the server, like this:

$ sudo rsync --delete -Phaze 'ssh -p [X]' /example/source/directory/ admin@domain.tld:/home/yunohost.app/filebrowser/me

…where [X] refers to the port number I’m using for SSH (I’ve changed it from 22).

However, when I try this, it throws up an error about permissions:

rsync: [Receiver] ERROR: cannot stat destination "/home/yunohost.app/filebrowser/me": Permission denied (13)

I notice that the destination me/ folder is owned by a user named filebrowser, which is a member of a group also named filebrowser.

The me/ folder’s permissions for ā€˜others’ are r-x, so I could modify them to rwx to allow myself to write to the folder remotely, but for security I don’t want to make the folder so accessible.

Is there any other way to allow my laptop, or more specifically the sole user of my laptop, to write to the me/ folder on my server?

Hi,

To connect to your server with a certain user, and do operations with another one, you might be interested by the explanations on this topic.

Thank you.
I tried following the advice there, including editing the server’s /etc/sudoers file*, and have reached the point where I am typing the below into the command line. I open two terminal windows; on one I SSH into the server and on the other (as my laptop user) I type:

sudo rsync --delete --rsync-path 'sudo echo "mypassword" | sudo -Su filebrowser /usr/bin/rsync' -Phauze 'ssh -p X' /home/MyLaptop/Desktop/example/ admin@domain.tld:/home/yunohost.app/filebrowser/me

… where ā€œmypasswordā€ is my Yunohost admin password, and X is the port number I’m using for SSH. Here I’m doing a test run with a simple, empty text file sitting in a folder called example on my Desktop.

It returns these error messages:

[sudo] password for admin: rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
rsync error: error in rsync protocol data stream (code 12) at io.c(228) [Receiver=3.2.3]
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(228) [sender=3.2.3]

General internet searches suggest that code 12 rsync errors can have a wide variety of causes but I haven’t singled any out in my case. One suggestion is that it’s a known bug in rsync itself… which doesn’t help.



* Re. my server’s /etc/sudoers/ file, I used sudo visudo to edit it and added an entry for user admin underneath the one for root, which was already there, under the heading:

# User privilege specification
root    ALL=(ALL:ALL) ALL
admin   ALL=(filebrowser:filebrowser) /usr/bin/rsync

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.