From 66248d93b4f7b016365a86f5f0cf49735a446f96 Mon Sep 17 00:00:00 2001 From: admManuel Date: Sun, 4 May 2025 16:58:23 +0000 Subject: [PATCH] Update Linux/SSH/README.md --- Linux/SSH/README.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Linux/SSH/README.md b/Linux/SSH/README.md index 6cd5508..49f28de 100644 --- a/Linux/SSH/README.md +++ b/Linux/SSH/README.md @@ -252,7 +252,17 @@ AllowUsers $VALID_USERS EOL log "Prüfe SSH-Konfiguration..." -if sudo sshd -t && sudo systemctl restart sshd; then +# Überprüfe, ob der Dienst 'ssh' oder 'sshd' existiert und starte ihn +if systemctl list-units --type=service | grep -q "ssh"; then + SERVICE_NAME="ssh" +elif systemctl list-units --type=service | grep -q "sshd"; then + SERVICE_NAME="sshd" +else + error "Kein SSH-Dienst gefunden." + exit 1 +fi + +if sudo systemctl restart $SERVICE_NAME; then log "SSH-Dienst erfolgreich neu gestartet." else error "Fehler beim Neustart des SSH-Dienstes."