Tell sshd not to detach into the background.
This makes it easier for systemd to track it and avoids race conditions such as this one: systemd[1]: PID file /run/sshd.pid not readable (yet?) after start. systemd[1]: Failed to start SSH Daemon. systemd[1]: Unit sshd.service entered failed state. systemd[1]: sshd.service holdoff time over, scheduling restart. systemd[1]: Stopping SSH Daemon... systemd[1]: Starting SSH Daemon... sshd[2315]: Server listening on 0.0.0.0 port 22. sshd[2315]: Server listening on :: port 22. sshd[2335]: error: Bind to port 22 on 0.0.0.0 failed: Address already in use. sshd[2335]: error: Bind to port 22 on :: failed: Address already in use. sshd[2335]: fatal: Cannot bind any address. systemd[1]: Started SSH Daemon.
This commit is contained in:
parent
fabe06337e
commit
03f13a4939
|
@ -351,10 +351,10 @@ in
|
|||
serviceConfig =
|
||||
''
|
||||
ExecStart=\
|
||||
${pkgs.openssh}/sbin/sshd -h ${cfg.hostKeyPath} \
|
||||
${pkgs.openssh}/sbin/sshd -D -h ${cfg.hostKeyPath} \
|
||||
-f ${pkgs.writeText "sshd_config" cfg.extraConfig}
|
||||
Restart=always
|
||||
Type=forking
|
||||
Type=simple
|
||||
KillMode=process
|
||||
PIDFile=/run/sshd.pid
|
||||
'';
|
||||
|
|
Loading…
Reference in a new issue