When I originally wrote about keeping your data safe, it was when I wrote about Linux, Nginx and WebDAV at one of my old websites in May 2020, which I moved to this website in July 2020. I suggest reading it if you want my opinions on data safety. SSHFS can be used in place of WebDAV when a URL connection isn’t required.
I’m not going into detail about the various distributions. That requires more work than I’m willing to put into it. All I know for sure is that SSHFS works on Debian, Ubuntu and their derivatives, including Linux Mint.
Since I wanted the SSH daemon on my service listening on an alternate port, using public key authentication and not allowing root login when I set up the virtual private server, I had to make changes to the /etc/ssh/sshd_config file. I had to add the alternate port to the file (Port XXXX).
For some reason I can’t fathom, I couldn’t connect using SSHFS until I replaced “Subsystem sftp /usr/lib/openssh/sftp-server” with “Subsystem sftp internal-sftp” in the same file. Whether I needed it or not, I uncommented “user_allow_other” in /etc/fuse.conf on my local machine.
The advantage of SSHFS over WebDAV is that the SSH server is already installed. Install SSHFS, create a mount point and add a single line to /etc/fstab, and you’re ready to rock. Installing SSHFS is as simple as:
sudo apt install sshfs
After it finishes, edit /etc/fuse.conf and uncomment the line for “user_allow_other”. Then create a mount point and replace “dir” with whatever you want:
sudo mkdir /mnt/dir
Add this to /etc/fstab, replacing “user” with the correct username and “/mnt/dir” with the correct mount point :
firstname.lastname@example.org:/home/user /mnt/dir fuse defaults,allow_other,users,idmap=user,reconnect,_netdev,port=XXXX,IdentityFile=/home/user/.ssh/id_rsa 0 0
It works for me. I can’t guarantee it will work for you. There are plenty of tutorials out there, some good and some bad. I’m happy if I’ve helped you understand even a little of the examples I’ve provided.
I store my KeeWeb database on my virtual private server. To use it with my cell phone, I need a URL connection. That’s really the only thing I need WebDAV for. If I ever decide to move the database to a cloud service, like Dropbox or Google Drive, I won’t need WebDAV at all. Even though I can mount the WebDAV share, mounting SSHFS seems to be more reliable.
I only need one drive mounted to update the server files for this website. Since an SSH share works as well as or better than a WebDAV share, SSHFS is what I now prefer. Mounting multiple devices from the same server seems much like overkill to me. I’m sure it would only be useful when sharing server resources with multiple users.