Feature Request: SSH Sync Support

Good day,

I searched in the forum and I did not see this requested yet. Is there a way to get an SSH target as a sync option? It looks like there are several NodeJS SSH libraries that might make this an easier task for an expert in the Joplin codebase.

Thanks for your time!

7 Likes

Couldn’t you mount the ssh folder locally, then use local file sync?

Might be problematic on mobile I suppose.

In what context are you using SSH? I’ve only used it primarily for logging into my server and that’s all.

I just looked into it. Are you talking about rsync ?

Yeah mobile might have a problem with mounting a volume over SSH. I have other services that backup/sync to my server over SSH/SFTP using native/plugin-supported functionality and it works great. In my opinion, the least amount of services exposed to the internet as possible is just plain-ol’ good security practice. I have a WebDAV server, but other than for Joplin, I have no need to expose it to the internet.

I suppose, as a workaround (and I’m thinking out loud right now), I could tunnel WebDAV over SSH with PuTTY (I’m on Windows), which would allow Joplin to sync when I manually open that connection. I think I am happy with that? Given this purposefully-intermittent quality of my workflow, Joplin wouldn’t end up deleting all my notes because it couldn’t connect to my WebDAV server, would it?

Edit: Well, that’s not going to be very easy to do on mobile. Possible, but impractical in the least.

You could check into rclone for ssh to webdav on desktop and then leave mobile on Webdav.

Thanks! I’ll check it out. Leaving mobile on WebDAV still exposes my WebDAV server directly to the internet, doesn’t it? That’s what I’m trying to avoid by using a “lighter” service that I already have, Like SSH/SFTP.

1 Like

It will, but you could enable ssl (https) on your webdav server (if not enabled already) and use Joplin’s E2EE to make sure your notes stay private as much as possible. If you’re not already using it, you could also move from normal WebDAV to Nextcloud on something like Digital Ocean and crank up your security settings.

You’ll need to make sure you make a full sync and backup to Jex on your Desktop. Then move your Joplin folder (including .resource(s) hidden folder) to the Nextcloud instance before switching over. You’ll also need to reset Joplin on everything by uninstalling on mobile and moving your joplin-desktop folder to a new location

Thank you for the reply. I appreciate the time it took for your to work through my problem with me. Unfortunately, I just don’t think that will solve my issue and I still would like to request that SSH/SFTP sync support get added to the long list of feature requests.

1 Like

Both protocols aren’t a common enough request from users here. Neither are difficult to use but the common computer user probably wouldn’t find any value in knowing them since there are plenty of others that require almost no setup and file system sync bypasses this issue for enough users here (despite it sucking for mobile users).

I hope more people ask for this and a compromise can be made to make supporting it not be too much of an issue for the devs to keep it functional. I’m all for adding as many options as possible for users to use software in uncommon ways like this. :wink:

I would like ssh/sftp too.
I do not want to use external providers.

ssh / sftp can be configured on any router or smart TV.

And now, in order for me to work, I need a separate LXC container, and configure a web server there with webdav ...
pointless waste of resources :rage:
Thanks!

Yes, me too, for the Android app.

I synchronize with my NAS to avoid any third party provider, and WebDAV forces me to open a port to the web server, which is less secure than SFTP (E2E encryption does not solve the problem, here the problem is that the web server is a security hole for the whole NAS and even my local network).

For info, I use 2 other Android applications, FolderSync & KeePass, and both support SFTP.

Cheers

I could use ssh/sftp too.

I would love ssh/sftp support too. The benefits I see are:

  • Easy to host my own sync server through my firewall (or over vpn)
    • ssh is much easier to maintain both in terms of security, as well as moving around
  • Alternatively, I could even just spin up a vps and host my notes

mounting over ssh is much more of a hassle, as I normally don't want to use the publicly available ssh system for much else, and as previous commenters already noted - mounting is not easy for mobile devices.

2 Likes

Just made an account to chime in on ssh.
Mounting volumes on mobile requires root. Thanks google.
ssh is super easy to setup and use. It does way more than just "log in" and without any extra configuration.
I was hoping joplin would be nicer than sshing into a personal server and using vim, (which works really well on mobile), but I'm not ready to hand over all my data to Dropbox, Inc or follow a big encryption guide.

1 Like

I did the same thing as logarithmicGravy99, created an account just to ask for this, then see that people have already been asking for it for quite some time. My reason for wanting to do this is I want to use Joplin on two Macs and a Windows box, and have all the notes synced to a specific directory on a Raspberry Pi. The Pi already has a bunch of stuff running on it so I do not want the extra bloat of having to add an additional server that I then have to figure out how to configure and maintain, when all I really want is to just sync to a directory on the Raspberry Pi. And SSH would be the easiest way to do that because it doesn't make any assumptions about whether the directory is already mounted; instead it just logs in and does the file transfers and logs out.

By the way when I say SSH what I probably really mean is SSHFS because I want to be able to transfer files, not open a terminal window. That may be what everyone else is wanting as well.

1 Like

Hi everyone. Just joined this forum as I got SSH working. Want to help people out who want the same. In the past I tried:

  • OneDrive: This was dreadfully slow.
  • A free Nextcloud provider Tab.digital: This was faster, but still slow. The worst part was the site went down for something like 2 hours at times. That was too frustrating to me.

SSH is clearly the best option available. Minimal overhead, as all it's doing is file transfer. Maximum security, since there's no middleware like Nextcloud, requring people to open ports.

Like @laurent said at the start of the thread, you can absolutely mount the SSH folder locally. To do this on my phone, I used EasySSHFS. Root is required. Ignore the error fuse.sshfs is not in /proc/mounts, as that's just a warning per [pattern fuse.sshfs is not in /proc/mounts · Issue #3 · bobrofon/easysshfs](https://github.com/bobrofon/easysshfs/issues/3). On the computer just add a relevant entry to /etc/fstab. Joplin works perfectly.

I think on other threads people mentioned Termux. That indeed has a SSHFS package, but rooting is also required there. Even worse, when mounting a folder there, you can only access the files with tsu. See [Package request: sshfs · Issue #45 · termux/termux-root-packages](https://github.com/termux/termux-root-packages/issues/45#issuecomment-996563775). I don't see a way for other apps to access the mount easily.

I even believe that mounting locally is better than Joplin adding SSH options into the GUI. SSH config can be complex, so that can be very messy, depending on how it's done.

3 Likes

Just an update to my previous post. I cannot edit it, so posting a new reply.

It is indeed possible to mount a SSHFS folder in Termux. You do not need tsu. Having su from Magisk is enough.

Previously I tried this without much luck. I wasn't aware that Android has this security feature called "mount namespace separation". This means that by default, each app gets their mount points isolated. This can be overcome using su --mount-master.

In order to mount your SSHFS folder in Termux, first install the sshfs package. Add the following script. Change all the parts I marked with XXX to your own values. Run it.

To run it at boot, install Termux:Boot. Then place this in ~/.termux/boot/, say ~/.termux/boot/start-sshfs.

#!/data/data/com.termux/files/usr/bin/sh
termux-wake-lock
# `su` binary from *Magisk*. Used to mount in the global mount namespace, so all apps have access to our mount.
# 
# `-o sshfs_debug` is required for this to work for some reason.
su --mount-master --command \
/data/data/com.termux/files/usr/bin/sshfs \
-o sshfs_debug \
-o ssh_command=/data/data/com.termux/files/usr/bin/ssh \
-o UserKnownHostsFile=/dev/null \
-o StrictHostKeyChecking=no \
-o rw \
-o dirsync \
-o nosuid \
-o nodev \
-o noexec \
-o umask=0 \
-o allow_other \
-o uid=9997 \
-o gid=9997 \
-o IdentityFile=XXX_IDENTITY_FILE_PATH_XXX \
-o port=22 \
-o reconnect \
-o ServerAliveInterval=15 \
-o ServerAliveCountMax=3 \
XXX_USERNAME_XXX@XXX_IP_XXX:XXX_REMOTE_PATH_XXX \
XXX_LOCAL_PATH_XXX
1 Like

+1000 for ssh/sftp/scp sync. it should be fairly easy to implement, just file sync over scp/sftp
i tried using sshfs on my mac and it likes to randomly hang and makes it unusable and i have to reboot (by holding the power button)

ssh support would still be good. i recently picked up joplin again and noticed its lacking it, googled and found this thread, tried to make an account to comment, and found that id posted here over a year ago. man

I too would very much appreciate ssh/sftp/scp support. Then I could sync with rsync . net .