𐑑𐑕

πŸ“ Portfolio 🎢 Music 🎨 Art 🍳 Recipies πŸ“œ Blog

../ blog / ssh-sftp-cloud

My SSH and SFTP "Cloud" Setup

The ultimate cloud setup for minimalists!

Secure SHell

2024.09.14 - 15

TLDR;

Stock sshd with vim, tmux, and ksh on the server and:

Introduction

I've used a variety of cloud services and providers over the years. In 2018 I got paranoid for digital privacy and control, so I switched back to the good-ol' sneakernet. However, that changed with the one thing I grew fond of from 2023 - 2024: Nextcloud. Thanks to some random Linux video, I was able to host my own online cloud suite! After a rocky start, I got it working great on OpenBSD. It served me well, but then I moved.

In 2024 I moved to a new area with the same, subpar electric "provider" and "deliverer" that we call "ameren." Since the location was more rural and the house mainly *shudders* electric, the bill was quite a bit higher. I sought to address this by cutting back on usage, and that meant shuttering my trusty and faithful desktop server running OpenBSD. I swapped it out with my only computer (sans smartphone) that survived the house fire: my Raspberry Pi 3B+. After all, a max draw of 5.1 watts is much more preferable to a desktop of 180-400 watts...

As I wanted to conserve resources, as well as space, on the Pi3, I decided to drop Nextcloud while keep the files accessible. However, I grew spoiled by the integrated DavCalendar, files synching, and text editing all in one with chat. As I am keeping my internet "affordable" as best I can, the end result is that I have a max upload of 1 MBps. That's fairly slow. Add the Pi3B+'s ethernet port sharing the USB bus and yeah... unfairly slow.

I had used Nextcloud on my desktop "server" with a 1 MBps upload before and boy was it... painful. I wanted to cut the cruft of sloppy PHP code, extra crap to translate, Javascript and web pages. I remembered the Pi 1 model B that was sadly burnt beyond recognition with a former internet provider that is so bad that I won't even say their name. With that crap internet connection, I used SSH. I decided to try it out to see if I could do it. I did and I have a new setup that I love and that works great for me!

The Server Side

Practically, on the server, I use the default sshd included by default. With a few basic users and keys set up, I have all I need. For hosting my website, I use OpenBSD's httpd or nginx. For the DAV stuff I can't live without, I use radicale. I also use tmux for managing my ssh session in a way to have a persistent session to pick up my work from anywhere. This is a benefit over migrating between devices and web browsers, and is a good compromise and solution to the problem I had with web browsing sessions in Brave: nothing sticks outside of the web address. Rather than use the simpler, all-in-one Nextcloud, I needed to save on resources and cut on constraints such as the limited memory, power, and bandwidth a Pi and my circumstances provide. Therfore the heavy-hitting part comes with the clients.

The Client Side

The server side is pretty basic, and doesn't require much. However, the clients need to meet some basic needs of mine. First, preservation of file attributes and metadata like modified time, permissions, owner, etc. Second, the client should allow me to edit files easily and visually for my smartphone or desktop when I'm on the run, without me needing to download/upload when changes are made. Third, the software should be as free and as minimal as possible outside of the first two needs. Granted, I could use ssh and sftp that's included by default on most systems, but try that on an Android...

The first point is needed for the fact that I like to know when files were download, uploaded, or modified. It helps me with nostalgia factors to see a file for that year and bring the memories back into context. rsync is perfect for this, and has more depth and details, as well as better caching for network-related file transfers. For larger files, this is important. For Windows, the alternative is WinSCP, as it preserves metadata on Windows transfers.

The second point is met by WinSCP on Windows, and I am fine with using the terminal via SSH elsewhere, but what about my phone, where the terminal experience is utterly dispicable? Luckily there was one such app on F-Droid: FTPClient. Basic, minimal, but sucks at preserving metadata. rsync through Termux to the rescue, but boy is it a hassle! I use it for mass-transfers of important files only. Otherwise FTPClient works great! I use it as the file editor for text files from my phone.

The third point is mainly addressed by all of the softwares mentioned: they're all as free, libre, and open-source as can be!

The Point

While it is a bit of a shift in workflow, this simple SSH-based setup allows me to have a similar setup as I did with Nextcloud, but minus the overhead. The only thing missing is the chat functionality, but that's for another time...