Created
May 13, 2017 15:54
-
-
Save TimJDFletcher/f402251a1b955e47c22ef245c343621a to your computer and use it in GitHub Desktop.
Systemd unit to generate missing ssh keys on boot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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 |
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
Intended for installing pre-imaging on Linux systems to generate fresh keys on first boot.
Copy to
/etc/systemd/system/ssh-keygen.service
Enable with
systemctl enable ssh-keygen.service