0

https://fedoramagazine.org/systemd-converting-sysvinit-scripts/ states

Here’s a fun fact: everything handled by that 184 line shell script is now handled by 27 lines of systemd configuration, spread across two unit files.

I can find the first file at /usr/lib/systemd/system/sshd.service:

[Unit]
Description=OpenSSH server daemon
Documentation=man:sshd(8) man:sshd_config(5)
After=network.target sshd-keygen.service
Wants=sshd-keygen.service

[Service]
EnvironmentFile=/etc/sysconfig/sshd
ExecStart=/usr/sbin/sshd -D $OPTIONS
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=on-failure
RestartSec=42s

[Install]
WantedBy=multi-user.target

What second file is required and where is it located?

2 Answers 2

1

The init script in the article starts sshd-keygen before starting sshd so the second unit file being referred is probably the /usr/lib/systemd/system/sshd-keygen.service file.

Note that, in the systemd case, sshd-keygen is not strictly required by sshd since it configured with Wants=sshd-keygen.service option. Even if sshd-keygen.service fails or is not available, sshd will still be started by systemd. However, in the init script linked in the article, it is a strict requirement since the script will fail if sshd-keygen fails or is not available.

2
  • Thought they were talking about /etc/sysconfig/sshd, but the number of lines didn't match. Commented May 30, 2017 at 17:59
  • That is the config file for sshd. That will exist even for systemd since that is were sshd gets it's config options from. (EnvironmentFile= option in the [Service] section) Commented May 30, 2017 at 18:03
0

The second file is sshd-keygen.service, which is referenced in your snippet it above.

You can use locate sshd-keygen.service to find the file on your system. It's likely located at /usr/lib/systemd/system/sshd-keygen.service.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.