Skip to content

Instantly share code, notes, and snippets.

@TimJDFletcher
Created May 13, 2017 15:54
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save TimJDFletcher/f402251a1b955e47c22ef245c343621a to your computer and use it in GitHub Desktop.
Save TimJDFletcher/f402251a1b955e47c22ef245c343621a to your computer and use it in GitHub Desktop.
Systemd unit to generate missing ssh keys on boot
[Unit]
Description=Generate sshd keys
Before=ssh.server
[Service]
Type=oneshot
ExecStart=/usr/bin/ssh-keygen -A
RemainAfterExit=true
StandardOutput=journal
[Install]
WantedBy=multi-user.target
@ambakshi
Copy link

ambakshi commented Aug 6, 2020

That should be Before=ssh.service , not ssh.server

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment