How to audit stale SSH keys with ssh-keygen‑l and fail2ban to stop brute‑force leaks on production servers

Auditing Stale SSH Keys with ssh-keygen -l and Protecting with fail2ban

SSH keys that sit unused for months can become a silent backdoor if a private key ever gets compromised. On a production server the safest way to keep the key list lean is to audit it regularly and block any brute‑force attempts that surface while you’re cleaning up.

1. List all authorized keys with fingerprints

The authorized_keys file lives in each user’s ~/.ssh/. To see which keys are actually present, run:

[Read More]

When My Ubuntu 24.04 VPS Runs Out of Disk: A Step‑by‑Step Cleanup Script That Keeps Your Apache Logs from Failing

Disk exhaustion is the most common cause of a sudden “500 Internal Server Error” on a small VPS.
When the filesystem that holds /var/log/apache2 is full, Apache can’t rotate or write new logs, and the web server silently stops accepting requests.
The fix is usually a quick cleanup, but doing it manually every time is error‑prone and can leave you with the same problem again.
Below is a practical, repeatable script that:

[Read More]

How I Configured Caddy as a Reverse Proxy for My Home Lab and Solved the HTTPS Redirect Bug

Setting up Caddy as a reverse proxy for my home lab

I’ve been juggling a Plex server, Nextcloud, and a little Go API all on the same Ubuntu 24.04 box. The goal was simple: a tidy public URL for each service, automatic HTTPS, and as little upkeep as possible. Caddy 2.7 fit the bill perfectly—its ACME integration is a one‑liner, and it ships with HTTP/2 out of the box.

1. Install Caddy

sudo apt update
sudo apt install -y debian-keyring debian-archive-keyring
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | \
  sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/caddy-stable-archive-keyring.gpg] \
  https://dl.cloudsmith.io/public/caddy/stable/deb/debian any main" | \
  sudo tee /etc/apt/sources.list.d/caddy-stable.list
sudo apt update
sudo apt install -y caddy

Caddy boots as a systemd service automatically. Just double‑check that it’s listening on the web ports:

[Read More]

Recovering a single config file from a corrupted Borg backup without restoring the whole archive

Recover a single file from a damaged Borg archive

When a Borg repository gets corrupted, the instinct is to dump the whole thing back. That’s usually overkill if you just need one config file. Borg actually gives you a fine‑grained extraction tool that can pull a single file even from a partially broken archive.

1. Verify the repository

borg check /srv/backups/myrepo

borg check will surface any integrity problems. If you see corruption, you can try to fix it:

[Read More]

Using a systemd path unit to clean my home server’s cache when disk space hits 90%

When the disk is almost full

I’ve run a handful of home‑servers for years, and the first thing that usually trips you up is a suddenly full disk.
Caches from apt, Docker, Flatpak, and the like can balloon without you noticing.
A quick, automated cleanup that only kicks in when the root filesystem is >90 % used keeps the system sane without you having to remember to run a script every week.

[Read More]

Running a nightly backup script after logout with systemd user units – no nohup needed

Running a nightly backup script after logout with systemd user units – no nohup needed

I set up a little home‑lab server last year and wanted a way to snap my home directory every night without tying the job to a terminal. The old nohup trick works, but it leaves orphaned processes and you end up chasing logs in the dark. Systemd user units give a cleaner, more reliable solution that plays nicely with the rest of the system.

[Read More]

Pulling the top 10 HTTP status codes from an Nginx access log with awk

Pull the top 10 HTTP status codes from an Nginx access log with awk

When you’re running a small site or a homelab server, the access log is the first place you look for clues about what’s happening. A quick glance at the most frequent status codes can tell you whether a recent change broke something, if a bot is hammering your API, or if a mis‑configured rewrite is returning 404s for legitimate pages.
Below is a practical, one‑liner‑heavy walk‑through that shows how to extract the top ten status codes from a standard Nginx log using only awk. It covers common pitfalls, performance tricks, and a few security‑related notes that fit naturally into a daily‑use workflow.

[Read More]

Taming Disk Usage with btrfs Snapshots and Automatic Pruning on My Homelab Server

Introduction to btrfs Snapshots

As someone who’s run a homelab for years, I’ve learned that managing disk space is key to keeping my servers running smoothly. One of the most effective ways to keep disk usage under control is by using btrfs snapshots. I’ve seen this go wrong when people don’t have a solid backup strategy, and btrfs snapshots have been a lifesaver for me. The real trick is to use them in conjunction with a solid backup plan.

[Read More]

Taming My Self-Hosted Chaos: Managing SSL Certificates Across Multiple Home Services

Introduction to Self-Hosted Chaos

I’ve been self-hosting various services at home for a while now, and one thing that’s always been a pain point is managing SSL certificates. With multiple services running on different machines, each requiring its own certificate, it’s easy to lose track of which ones are due for renewal. I’ve seen this go wrong when a certificate expires unexpectedly, taking down a service with it. To avoid this, I’ve implemented a centralized certificate management system, which I’ll outline in this article.

[Read More]

Rescuing a Borked Linux System with Rsync and Temporary Snapshots

Introduction to Rescuing Borked Linux Systems

I’ve seen this go wrong when you least expect it - a misconfigured system file, a failed update, or an accidental deletion of a critical file can leave your Linux system in a borked state. Whether you’re working on a desktop, server, or in a homelab setup, having a reliable method to rescue and restore your system is invaluable. In my experience, rsync combined with temporary snapshots is one of the most effective tools for this purpose.

[Read More]