working today on macOS, Linux and Windows

ssh keys that expire by themselves.

Automatic SSH key rotation: a new login key every day, signed on your own machine by a key that never leaves your hardware. No server to run. Nothing to log in to.

today's key, in the frame OpenSSH draws around a key. its teeth come from the same bytes as the picture below, and it is recut at every rotation.
you@laptop

        
today's keyvalid

            
expires by itself in25:00:00
A copied SSH key works forever, from anywhere, for whoever holds the file. Ours is redrawn tomorrow, and the key that draws the next one cannot be copied at all.
lifetime of an ordinary SSH key ∞

Backups, synced folders and stolen laptops all carry a key that never expires.

longest a rotated key stays valid 25hours

After that the file is worthless. Servers refuse it without being told anything.

servers, accounts and daemons to run 0

One line on each server, once. Everything else happens on your own machine.

HOW IT WORKS

Servers trust you once. Your keys change every day.

It is standard OpenSSH certificates, with the signing key locked inside your own hardware and the rotation made automatic.

01

Trust once

Each server gets one line naming your certificate authority. It is checked with a real certificate login before anything is switched over.

02

Rotate daily

A fresh key every day, or as often as you set, down to minutes. It is signed after Touch ID, a password, or a touch of your security key, and a background check does it for you.

03

Old keys expire

Yesterday's key stops working by itself. Nothing to revoke, nothing to clean up on the servers, and you keep typing ssh server.

PRODUCT

Built for the part people skip.

Rotation means nothing while an old permanent key still gets in, and removing it is only safe with a way back. The tool handles both.

01

Hardware-held signing key

Secure Enclave with Touch ID on a Mac. A password or a FIDO security key on Linux and Windows. Never an unprotected file unless you ask for one.

02

Audit

Lists every other key your servers and Git accounts still accept, tells yours apart from other people's, and gives the command that retires each one.

03

Recovery key

A password-protected spare, installed everywhere and kept off the machine, so a lost laptop is an inconvenience and not a lockout.

04

Git accounts in step

GitHub, GitLab, Bitbucket, Forgejo and Gitea get each new key through their API, and the previous one is removed.

05

Hard to lock yourself out

Changes are verified before and after. A bad change is put back by the server itself within two minutes. The last key of an account is never removed by accident.

06

Fits how you deploy

The same trust as a NixOS option, cloud-init user data, an Ansible task, a whole-server sshd setting, or PowerShell for Windows servers.

THE APP

One window. One button.

For people who would rather click than type, a native Mac app sits on top of the same engine.

  • Turns rotation on, with or without Touch ID.
  • Renews a key that is due the moment you open it.
  • Shows which servers still accept an old key, with a button to retire it.
  • Connects Git accounts and creates the recovery key.
The sshrotate Mac app showing SSH key rotation turned on, two servers and connected Git accounts
DOWNLOAD

Up and rotating in a minute.

Free to use. One command installs it for your account only; nothing runs as root and nothing is added to your servers until you say so.

macOS · Linux · Windows (Git Bash)

Command line

curl -fsSL https://www.sshrotate.com/install.sh | bash

Then ssh-rotate add user@your-server. On a Mac it uses the Secure Enclave; add -s -- --touch-id to the command to require Touch ID. Elsewhere it asks you to choose a password.

Needs bash and OpenSSH 8.2 or newer. On Windows, run it in Git Bash; the command then also works from PowerShell.

macOS 14 or newer · Apple silicon

Mac app

curl -fsSL https://www.sshrotate.com/install-app.sh | bash

Paste that into Terminal and the app appears in Applications. It includes the command line tool.

Or download the zip. The app is not yet signed with an Apple developer certificate, so a copy downloaded with a browser has to be allowed once under System Settings → Privacy & Security.

PROOF

Tested against real machines on every change.

Security tools are easy to fake. This one is run end to end, on real servers, each time the code changes: more than 390 automated checks.

LinuxClient and servers on Debian, Ubuntu, Alpine and Fedora, OpenSSH 8.2 to 9.9. Password, security key and agent-held signing keys.automated
WindowsUnder Git Bash, with both Git's ssh and Windows' own ssh.exe, against Windows' own OpenSSH server.automated
macOSClient logic and the app's logic on every change. Secure Enclave and Touch ID on a real Mac.automated + by hand
Git hostingReal Forgejo and Gitea servers, including logins before and after a rotation. GitHub on a real account.automated + by hand
Not yet provenA physical FIDO key (tested with OpenSSH's software one), and GitLab and Bitbucket against the live services.open
STRAIGHT TALK

What it does not do.

  • It does not stop someone who controls your unlocked machine while you use it. It limits them to today.
  • A fingerprint prompt cannot say what it is for. Approve one you did not cause and you have signed a key for whoever asked.
  • Today it manages one person's keys. Teams are next.
WHERE IT GOES

From one laptop to a whole team.

Teams. One place to see who can reach what, and to remove a person in one step.planned
Fleets. Enrol hundreds of servers from an inventory, and report what still accepts permanent keys.planned
Apps everywhere. Signed desktop apps for Windows and Linux alongside the Mac one.planned
QUESTIONS

The short answers.

What is sshrotate?

sshrotate is a free tool that rotates your SSH login keys automatically. Your servers trust one certificate authority, once. sshrotate then makes a new login key on your machine on a schedule, every day by default, and signs it with that authority, so a copied key file stops working within hours. There is no server to run and nothing to sign in to.

How do I rotate SSH keys automatically?

Install sshrotate with one command, then run ssh-rotate add user@server for each server. From then on a new key is made and signed on your machine at the interval you choose, and the old one expires by itself. Nothing is edited on the servers again.

Do I have to install anything on my servers?

No. Each server gets one line in authorized_keys that names your certificate authority. It works with the stock OpenSSH server on Linux, macOS, BSD and Windows.

How often do the keys rotate?

Every 24 hours by default. You can set any period from ten minutes to thirty days, for example ssh-rotate set every 30m or ssh-rotate set every 12h.

What protects the key that signs the others?

On a Mac it is created inside the Secure Enclave and cannot be copied, and it can require Touch ID for every new key. On Linux and Windows it is a file encrypted with a password you choose, or it can live on a FIDO2 security key such as a YubiKey.

Does it work with GitHub, GitLab and Bitbucket?

Yes. Hosted Git services accept only the exact keys listed on your account, so sshrotate uploads each new key through the service's API and deletes the previous one. GitHub, GitLab, Bitbucket, Forgejo and Gitea are supported.

What happens if I lose my laptop?

The certificates it could make expire by themselves. To get back in from another machine you use the recovery key: a password-protected spare key that ssh-rotate recovery create installs on your servers and that you keep off the laptop.

Which operating systems does it run on?

macOS, Linux, and Windows under Git Bash, where it also covers Windows' own ssh.exe. There is a Mac app as well as the command line.

Is it free? Is it open source?

It is free to download and use, for personal and commercial purposes. It is not open source: the tool is a readable shell script, but it may not be redistributed or republished in modified form.

More in the documentation, the guide to rotating SSH keys, and the comparison with step-ca, Teleport, Vault, Tailscale SSH and opkssh.

Want to back it?

sshrotate is free to download and use today. If you want to help take it to teams and fleets, get in touch.