brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: ssh-keygen -a sets how many rounds protect your key passphrase

Network and access
~/tips/tip-ssh-keygen-kdf-rounds

ssh-keygen -t ed25519 -a 100 -C "laptop"

Raises the number of key derivation rounds so a stolen SSH key file is harder to brute-force.

A passphrase on an SSH key is only as strong as the work needed to test a guess. ssh-keygen has a setting for that work, and I rarely see it mentioned.

When ssh-keygen saves a private key, it derives the encryption key from your passphrase, and -a sets the number of rounds. The man page gives the default as 32 and says a higher number slows down passphrase verification and makes brute-forcing harder.

ssh-keygen -t ed25519 -a 100 -C "laptop"

The price is a slightly longer wait at the passphrase prompt each time the key is unlocked. With an agent you pay it once per session.

An existing key can get a new value too. The man page says that changing the passphrase with -p also lets you change the cipher or the number of KDF rounds, with -Z and -a:

ssh-keygen -p -a 100 -f ~/.ssh/id_ed25519

It asks for the old passphrase and then the new one, and you can type the same one again. If that file is the only copy of the key, copy it first.

This protects the key file on disk. It does nothing for a key that someone reads from memory while it is loaded, and it cannot rescue a short passphrase. A long passphrase and a higher -a work together.

Further reading: ssh-keygen(1)

More Network and access tips scp -3 alice@server-a:/var/backups/db.sql.gz bob@server-b:/srv/restore/ tailscale exit-node suggest tailscale lock sign nodekey:1abddef1 tlpub:abcdef12 wg genpsk > peer1.psk Table = off All Network and access tips (163) All topics

Link