Openssh-server (sshd) disable signifie qu'il est supprimé

Tags: #<Tag:0x00007f338b831628> #<Tag:0x00007f338b831510>

Bonjour,

J’ai eu la désagréable surprise de voir mon service sshd disparaître quand je le met en disable.
Toutes mes machines ont openssh-server d’installé.
Sur les portable, je ne veut pas qu’il soit démarré au boot.
Donc j’ai fait les commandes:

systemctl stop sshd
systemctl disable sshd

seulement il me les as supprimés:

~# systemctl disable sshd
Removed '/etc/systemd/system/sshd.service'.
Removed '/etc/systemd/system/multi-user.target.wants/ssh.service'.

Et quand je veux le statut du service,il est introuvable:

~# systemctl status sshd
Unit sshd.service could not be found.

Et donc je ne peux plus le remettre actif:

~# systemctl enable sshd
Failed to enable unit: Unit sshd.service does not exist

en fait, quelle que soit la commande systemctl, il ne reconnait pas le service.
Le seul moyen c’est de supprimer le paquet et de le remettre :confused:

ai-je loupé quelque chose?
Car par exemple avec webmin ou cups je n’ai pas ce problème.

Une défaillance du paquet openssh-server de Trixie?
Et avec:

~# systemctl list-units | grep -i ssh
  sshd-unix-local.socket 

j’ai trouvé: il faut manipuler ssh au lieu de sshd et alors on peut enable à nouveau.

2 J'aime

t’aurais la description des 2 services ?

Les voici (je pense que le problème est du à la notion d’alias):

~# cat /usr/lib/systemd/system/ssh.service
[Unit]
Description=OpenBSD Secure Shell server
Documentation=man:sshd(8) man:sshd_config(5)
After=network.target nss-user-lookup.target auditd.service
ConditionPathExists=!/etc/ssh/sshd_not_to_be_run

[Service]
EnvironmentFile=-/etc/default/ssh
ExecStartPre=/usr/sbin/sshd -t
ExecStart=/usr/sbin/sshd -D $SSHD_OPTS
ExecReload=/usr/sbin/sshd -t
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=on-failure
RestartPreventExitStatus=255
Type=notify
RuntimeDirectory=sshd
RuntimeDirectoryMode=0755

[Install]
WantedBy=multi-user.target
Alias=sshd.service

~# cat /etc/systemd/system/sshd.service
[Unit]
Description=OpenBSD Secure Shell server
Documentation=man:sshd(8) man:sshd_config(5)
After=network.target nss-user-lookup.target auditd.service
ConditionPathExists=!/etc/ssh/sshd_not_to_be_run

[Service]
EnvironmentFile=-/etc/default/ssh
ExecStartPre=/usr/sbin/sshd -t
ExecStart=/usr/sbin/sshd -D $SSHD_OPTS
ExecReload=/usr/sbin/sshd -t
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=on-failure
RestartPreventExitStatus=255
Type=notify
RuntimeDirectory=sshd
RuntimeDirectoryMode=0755

[Install]
WantedBy=multi-user.target
Alias=sshd.service
``

vraiment surprenant :confused:
j’ai toujours vu dans les tutos l’utilisation de sshd.

y a un rapport de bug qui correspond à ta situation ?

sous bookworm, j’obtiens ça:

 systemctl status sshd.service 
● ssh.service - OpenBSD Secure Shell server
     Loaded: loaded (/lib/systemd/system/ssh.service; enabled; preset: enabled)
     Active: active (running) since Sat 2025-08-23 09:33:07 CEST; 1 month 24 days ago
       Docs: man:sshd(8)
             man:sshd_config(5)
   Main PID: 3274301 (sshd)
      Tasks: 1 (limit: 9230)
     Memory: 10.0M
        CPU: 1.183s
     CGroup: /system.slice/ssh.service
             └─3274301 "sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups"

systemctl status ssh.service 
● ssh.service - OpenBSD Secure Shell server
     Loaded: loaded (/lib/systemd/system/ssh.service; enabled; preset: enabled)
     Active: active (running) since Sat 2025-08-23 09:33:07 CEST; 1 month 24 days ago
       Docs: man:sshd(8)
             man:sshd_config(5)
   Main PID: 3274301 (sshd)
      Tasks: 1 (limit: 9230)
     Memory: 10.0M
        CPU: 1.183s
     CGroup: /system.slice/ssh.service
             └─3274301 "sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups"


systemctl cat sshd.service 
# /lib/systemd/system/ssh.service

realpath /etc/systemd/system/sshd.service
/usr/lib/systemd/system/ssh.service

je ne pense pas que ce soit un bug.
En creusant je me suis rendu compte que c’était voulu.