diff --git a/nixos/modules/services/networking/ssh/sshd.nix b/nixos/modules/services/networking/ssh/sshd.nix index 7e43ab98674..42b50d0426a 100644 --- a/nixos/modules/services/networking/ssh/sshd.nix +++ b/nixos/modules/services/networking/ssh/sshd.nix @@ -253,6 +253,10 @@ in preStart = '' + # Make sure we don't write to stdout, since in case of + # socket activation, it goes to the remote side (#19589). + exec >&2 + mkdir -m 0755 -p /etc/ssh ${flip concatMapStrings cfg.hostKeys (k: '' @@ -270,6 +274,7 @@ in KillMode = "process"; } // (if cfg.startWhenNeeded then { StandardInput = "socket"; + StandardError = "journal"; } else { Restart = "always"; Type = "simple";