My Doc Launcher Has No App Behind It (and How I Reset Its Password)

Illustration of a grid of glowing document cards on a server, with files syncing from a laptop and a padlock in front.
Dev Notes · Homelab

A private docs site built from nginx, rsync, cron, and two small Python scripts, plus what to do when you forget the login.


Every project I work on has a documentation/ folder: summaries, roadmaps, security notes, build logs. I read all of it through one page on my home network that I call the Doc Launcher. It shows a grid of project cards, and each card opens that project’s docs.

It looks like a web app, but there’s no app behind it, no database, and no login code. When I forgot its password, that turned out to be good news.

How It Works

Diagram: a workstation syncs documentation folders nightly over rsync with a write-only key to a home server, which serves them through nginx with basic auth to a browser on the home network.
Files flow one way: from each project’s docs folder, through a locked-down sync, into a folder nginx serves.

It has four parts, and each part does one job:

01

nginx serves one folder

A home server runs nginx on a LAN-only port and serves a single folder of static HTML, protected by HTTP basic auth.

nginx config
location /doc-launch/ {
    alias /path/to/docs-share/;
    index index.html;
    autoindex off;
    auth_basic "Docs";
    auth_basic_user_file /etc/nginx/.htpasswd;
}
More detailed infoLess info

Each project gets its own <project>_documentation/ subfolder. Because of autoindex off, nginx won’t list a folder’s contents, so the only pages you can reach are ones an index.html links to.

I treat this folder as read-only by hand. Every sync into it runs with --delete, so a file I drop in manually disappears on the next run.

02

rsync fills it on a schedule

A nightly cron job on my main workstation pushes every project’s documentation/ folder to the server over SSH. A shell menu runs the same job on demand.

you type
$ docslaunch          # menu: sync all / dry run / one project / list
$ docslaunch project myapp
More detailed infoLess info

docslaunch is a bash function in ~/.bash_functions. It holds the full Python command in an array, so I don’t have to type the long command with all its flags. With no arguments it shows a menu; with arguments (sync, dry, list, project <name>) it skips the menu.

Some projects are written on the server itself, not on the workstation. A second script on the server publishes those every hour. That brings up the most important rule in the setup.

03

One writer per folder

Each project folder in the share has exactly one script allowed to write to it. Otherwise two syncs that both use --delete would keep deleting each other’s files.

More detailed infoLess info
WriterRuns onWhenOwns
Main sync scriptWorkstationNightly + on demandMost projects, the home page, shared scripts
Server publish scriptServerHourlyProjects authored on the server
Book sync scriptServerManualA writing project

The workstation script keeps a short list (EXTRA_INDEX_CARDS) of projects that someone else publishes. For those it skips the sync but still draws a card on the home page. Before that list existed, the nightly --delete could have wiped everything the server had published.

04

Python builds the pages

Two small scripts generate the HTML. One builds the home page of project cards, and one builds an index page inside each project folder.

More detailed infoLess info
  • Home page: one card per project. The icon is picked by matching keywords in the project’s name (security → 🔐, video → 🎬).
  • Project pages: each doc’s title comes from its first # H1 heading, and its icon and one-line description come from keywords in the filename (roadmap, summary, security…).
  • One generator for both machines: the workstation pushes generate_index.py into the share, and the server’s publish script imports that same file. Both machines render pages the same way, and there’s no second copy to drift out of date.
Security

Keeping the sync key on a short leash

The SSH key that runs the sync can only write into the docs folder. It can’t open a shell or touch anything else on the server.

More detailed infoLess info

On the server, the key’s line in authorized_keys forces every session through rrsync in write-only mode:

authorized_keys
command="rrsync -wo /path/to/docs-share/" ssh-ed25519 AAAA... docs-sync
Two lessons from running it
  • Silent failures: I renamed a folder, the command= path stopped existing, and syncs failed for days with no visible error. Now a health check runs every 15 minutes and raises a desktop alert when a sync fails.
  • The agent picked the wrong key: running the sync from a desktop terminal let the desktop’s ssh-agent supply my unrestricted personal key, which skipped the jail entirely. The fix was -o IdentitiesOnly=yes -o IdentityAgent=none in the script, and I also removed the personal key from the server’s authorized_keys.

Forgot the Password? Reset It, Don’t Recover It

The login is plain nginx basic auth. The password file stores a one-way hash ($apr1$, Apache’s MD5-crypt), not the password, so you can’t read the old one back. You can only set a new one.

01

Check your browser first

If you ever saved the login, it’s in your browser’s password manager under the server’s address.

More detailed infoLess info

In Chrome, go to chrome://password-manager. In Firefox, go to about:logins. Search for the server’s IP or hostname. You can also see which username the server expects without sudo, because the file is world-readable:

you type
$ cut -d: -f1 /etc/nginx/.htpasswd
02

Set a new password

Run htpasswd with sudo on the server and enter the new password twice. You don’t need to reload nginx because it reads the file on every request.

you type
$ sudo htpasswd /etc/nginx/.htpasswd your-username
More detailed infoLess info
you’ll see
New password:
Re-type new password:
Updating password for user your-username

On Fedora and RHEL, htpasswd comes from the httpd-tools package. On Debian and Ubuntu, it’s in apache2-utils.

Careful

Don’t add -c

-c creates the file from scratch, which deletes every other user already in it. Leave the flag off when you’re changing an existing password.

Why I Like It This Way

Because the launcher is just files on disk, nothing has to stay running and there’s no app to patch. Forgetting the password took one command to fix. The only real rule is the one-writer-per-folder rule, and the scripts enforce it now, so I don’t have to remember it.

nostradmsx dev notes · self-hosted docs with nginx + rsync + cron