Aller au contenu principal
Sujet: Impossible de démarrer le service sshd sur Leap 15.1 (Lu 3189 fois) sujet précédent - sujet suivant

Impossible de démarrer le service sshd sur Leap 15.1

Bonjour à tous,

J'ai, depuis déjà pas mal de temps, des problèmes avec le service sshd de mon serveur local.
Le service est marqué en "échec" dans yast. Le port 22 est pourtant bien ouvert pour sshd dans firewalld.
Pas de problème au niveau du paquet openssh.
Lorsque j'essaye de démarrer à la main le service, Yast me répond "impossible de démarrer sshd qui est actuellement arrêté". Même chose en console.
Le passage de Leap 15.0 à 15.1 n'a rien changé, ce n'est donc pas un problème de paquet. Probablement un fichier de config qui a sauté ?  Je ne sais pas où chercher.

Je me sers de ssh pour me connecter à distance sur le serveur depuis un autre poste de la maison avec x2go.

Merci à vous !  :)

Re : Impossible de démarrer le service sshd sur Leap 15.1

Répondre #1
Salut,
Lorsque tu essayes de le démarrer, tu dois bien avoir un message d'erreur retourné. Poste le résultat de

systemctl status sshd
journalctl -xe

immédiatement après avoir essayer de le lancer.
Vérifie aussi que dans /etc/ssh tu as bien au minimum ces fichiers là:

ssh_config
sshd_config
ssh_host_dsa_key
ssh_host_dsa_key.pub
ssh_host_ecdsa_key
ssh_host_ecdsa_key.pub
ssh_host_ed25519_key
ssh_host_ed25519_key.pub
ssh_host_rsa_key
ssh_host_rsa_key.pub

As-tu modifié la configuration du démon ssh via /etc/ssh/sshd_config ? Si oui, poste nous le contenu de ce fichier.

 

Re : Impossible de démarrer le service sshd sur Leap 15.1

Répondre #2
Salut sogal et merci pour ta réponse si rapide !!!

Retour de systemctl status sshd :
systemctl status sshd
● sshd.service - OpenSSH Daemon
   Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Fri 2020-05-01 17:38:42 CEST; 13s ago
  Process: 1926 ExecStartPre=/usr/sbin/sshd -t $SSHD_OPTS (code=exited, status=255)
  Process: 1924 ExecStartPre=/usr/sbin/sshd-gen-keys-start (code=exited, status=0/SUCCESS)

retour de journalctl (que j'ai du lancer en root)
sudo journalctl -xe
[sudo] Mot de passe de root :
-- L'unité (unit) sshd.service a échoué, avec le résultat failed.
mai 01 17:38:41 serveur systemd[1]: sshd.service: Unit entered failed state.
mai 01 17:38:41 serveur systemd[1]: sshd.service: Failed with result 'exit-code'.
mai 01 17:38:42 serveur systemd[1]: sshd.service: Service RestartSec=100ms expired, scheduling restart.
mai 01 17:38:42 serveur systemd[1]: Stopped OpenSSH Daemon.
-- Subject: L'unité (unit) sshd.service a terminé son arrêt
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- L'unité (unit) sshd.service a terminé son arrêt.
mai 01 17:38:42 serveur systemd[1]: Starting OpenSSH Daemon...
-- Subject: L'unité (unit) sshd.service a commencé à démarrer
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- L'unité (unit) sshd.service a commencé à démarrer.
mai 01 17:38:42 serveur sshd-gen-keys-start[1924]: Checking for missing server keys in /etc/ssh
mai 01 17:38:42 serveur sshd[1926]: /etc/ssh/sshd_config line 128: Bad SSH2 mac spec 'hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,hmac-ripemd160'.
mai 01 17:38:42 serveur systemd[1]: sshd.service: Control process exited, code=exited status=255
mai 01 17:38:42 serveur systemd[1]: Failed to start OpenSSH Daemon.
-- Subject: L'unité (unit) sshd.service a échoué
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- L'unité (unit) sshd.service a échoué, avec le résultat failed.
mai 01 17:38:42 serveur systemd[1]: sshd.service: Unit entered failed state.
mai 01 17:38:42 serveur systemd[1]: sshd.service: Failed with result 'exit-code'.
mai 01 17:38:42 serveur systemd[1]: sshd.service: Service RestartSec=100ms expired, scheduling restart.
mai 01 17:38:42 serveur systemd[1]: Stopped OpenSSH Daemon.
-- Subject: L'unité (unit) sshd.service a terminé son arrêt
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- L'unité (unit) sshd.service a terminé son arrêt.
mai 01 17:38:42 serveur systemd[1]: sshd.service: Start request repeated too quickly.
mai 01 17:38:42 serveur systemd[1]: Failed to start OpenSSH Daemon.
-- Subject: L'unité (unit) sshd.service a échoué
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- L'unité (unit) sshd.service a échoué, avec le résultat failed.
mai 01 17:38:42 serveur systemd[1]: sshd.service: Unit entered failed state.
mai 01 17:38:42 serveur systemd[1]: sshd.service: Failed with result 'exit-code'.
mai 01 17:38:46 serveur postfix/pickup[25098]: 5D80D5DA3AD: uid=456 from=<netdata>
mai 01 17:38:46 serveur postfix/cleanup[2237]: 5D80D5DA3AD: message-id=<20200501153846.5D80D5DA3AD@localhost>
mai 01 17:38:46 serveur postfix/qmgr[1940]: 5D80D5DA3AD: from=<netdata@localhost>, size=9268, nrcpt=1 (queue active)
mai 01 17:38:46 serveur postfix/local[2254]: 5D80D5DA3AD: to=<root@localhost>, orig_to=<root>, relay=local, delay=0.22, delays=0.15/0.01/0/0.06, dsn=2.0.0, status=sent (delivered to mailbox)
mai 01 17:38:46 serveur postfix/qmgr[1940]: 5D80D5DA3AD: removed
mai 01 17:38:55 serveur kwin_x11[6383]: qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 25395, resource id: 94371968, major code: 19 (DeleteProperty), minor code: 0
mai 01 17:38:55 serveur kwin_x11[6383]: qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 25398, resource id: 94371968, major code: 19 (DeleteProperty), minor code: 0
mai 01 17:38:55 serveur kwin_x11[6383]: qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 25399, resource id: 94371968, major code: 18 (ChangeProperty), minor code: 0
mai 01 17:38:55 serveur kwin_x11[6383]: qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 25400, resource id: 94371968, major code: 19 (DeleteProperty), minor code: 0
mai 01 17:38:55 serveur kwin_x11[6383]: qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 25401, resource id: 94371968, major code: 19 (DeleteProperty), minor code: 0
mai 01 17:38:55 serveur kwin_x11[6383]: qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 25402, resource id: 94371968, major code: 19 (DeleteProperty), minor code: 0
mai 01 17:38:55 serveur kwin_x11[6383]: qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 25403, resource id: 94371968, major code: 7 (ReparentWindow), minor code: 0
mai 01 17:38:55 serveur kwin_x11[6383]: qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 25404, resource id: 94371968, major code: 6 (ChangeSaveSet), minor code: 0
mai 01 17:38:55 serveur kwin_x11[6383]: qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 25405, resource id: 94371968, major code: 2 (ChangeWindowAttributes), minor code: 0
mai 01 17:38:55 serveur kwin_x11[6383]: qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 25406, resource id: 94371968, major code: 10 (UnmapWindow), minor code: 0
mai 01 17:39:29 serveur plasmashell[6390]: qt.qpa.xcb: QXcbConnection: XCB error: 2 (BadValue), sequence: 44480, resource id: 65011718, major code: 142 (Unknown), minor code: 3
mai 01 17:40:12 serveur sudo[3074]: pam_unix(sudo:session): session opened for user root by administrateur(uid=0)

retour du ls /etc/ssh
ldap.conf  moduli  ssh_config  sshd_config  sshd_config.rpmnew  ssh_host_dsa_key  ssh_host_dsa_key.pub  ssh_host_ecdsa_key  ssh_host_ecdsa_key.pub  ssh_host_ed25519_key  ssh_host_ed25519_key.pub  ssh_host_key  ssh_host_key.pub  ssh_host_rsa_key  ssh_host_rsa_key.pub

Je ne crois pas avoir modifié sshd_config, mais au cas où :
#       $OpenBSD: sshd_config,v 1.101 2017/03/14 07:19:07 djm Exp $

# This is the sshd server system-wide configuration file.  See
# sshd_config(5) for more information.

# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin

# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented.  Uncommented options override the
# default value.

#Port 22
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::

#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_dsa_key
#HostKey /etc/ssh/ssh_host_ecdsa_key
#HostKey /etc/ssh/ssh_host_ed25519_key

# Ciphers and keying
#RekeyLimit default none

# Logging
#SyslogFacility AUTH
#LogLevel INFO

# Authentication:

#LoginGraceTime 2m
#PermitRootLogin yes
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10

#PubkeyAuthentication yes

# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2
# but this is overridden so installations will only check .ssh/authorized_keys
AuthorizedKeysFile      .ssh/authorized_keys

#AuthorizedPrincipalsFile none

#AuthorizedKeysCommand none
#AuthorizedKeysCommandUser nobody

# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes

# To disable tunneled clear text passwords, change to no here!
#PasswordAuthentication yes
#PermitEmptyPasswords no

# Change to no to disable s/key passwords
#ChallengeResponseAuthentication yes

# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes
#GSSAPIStrictAcceptorCheck yes
#GSSAPIKeyExchange no

# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication.  Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
UsePAM yes

#AllowAgentForwarding yes
#AllowTcpForwarding yes
#GatewayPorts no
X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
#PermitTTY yes
#PrintMotd yes
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS no
#PidFile /run/sshd.pid
#MaxStartups 10:30:100
#PermitTunnel no
#ChrootDirectory none
#VersionAddendum none

# no default banner path
#Banner none

# override default of no subsystems
Subsystem       sftp    /usr/lib/ssh/sftp-server

# This enables accepting locale enviroment variables LC_* LANG, see sshd_config(5).
AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
AcceptEnv LC_IDENTIFICATION LC_ALL

# Example of overriding settings on a per-user basis
#Match User anoncvs
#       X11Forwarding no
#       AllowTcpForwarding no
#       PermitTTY no
#       ForceCommand cvs server
Ciphers aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes128-ctr

MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,hmac-ripemd160

KexAlgorithms diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1

Voilà voilà, si ça te parle....  :o

Re : Impossible de démarrer le service sshd sur Leap 15.1

Répondre #3
Il manque la moitié de ton fichier sshd_config.
Dans ce que tu as posté aucun port ni adresse d'écoute n'est indiqué.

Re : Impossible de démarrer le service sshd sur Leap 15.1

Répondre #4
Ce qu'il manque:

#       $OpenBSD: sshd_config,v 1.103 2018/04/09 20:41:22 tj Exp $                
                                                                                 
# This is the sshd server system-wide configuration file.  See                   
# sshd_config(5) for more information.                                           
                                                                                 
# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin                 
                                                                                 
# The strategy used for options in the default sshd_config shipped with          
# OpenSSH is to specify options with their default value where                   
# possible, but leave them commented.  Uncommented options override the          
# default value.                                                                 
                                                                                 
#Port 22                                                                         
#AddressFamily any                                                               
#ListenAddress 0.0.0.0                                                           
#ListenAddress ::                                                                
                                                                                 
#HostKey /etc/ssh/ssh_host_rsa_key                                               
#HostKey /etc/ssh/ssh_host_ecdsa_key                                             
#HostKey /etc/ssh/ssh_host_ed25519_key                                           
                                                                                 
# Ciphers and keying                                                             
#RekeyLimit default none                                                         
                                                                                 
# Logging                                                                        
#SyslogFacility AUTH                                                             
#LogLevel INFO                                                                   
                                                                                 
# Authentication:                                                                
                                                                                 
#LoginGraceTime 2m                                                               
PermitRootLogin prohibit-password                                                
StrictModes yes                                                                  
MaxAuthTries 6                                                                   
MaxSessions 10                                                                   
                                                                                 
PubkeyAuthentication yes                                                         
                                                                                 
# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2    
# but this is overridden so installations will only check .ssh/authorized_keys   
AuthorizedKeysFile      .ssh/authorized_keys                                     
                                                                                 
#AuthorizedPrincipalsFile none                                                   
                                                                                 
#AuthorizedKeysCommand none                                                      
#AuthorizedKeysCommandUser nobody                                                
                                                                                 
# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts      
#HostbasedAuthentication no                                                      
# Change to yes if you don't trust ~/.ssh/known_hosts for                        
# HostbasedAuthentication                                                        
#IgnoreUserKnownHosts no                                                         
# Don't read the user's ~/.rhosts and ~/.shosts files                            
#IgnoreRhosts yes                                                                

Les lignes non commentées (non préfixées d'un #) sont celles que j'ai modifiées chez moi. Avant de copier-coller, vérifie que ça correspond à ce que tu veux faire.

Re : Impossible de démarrer le service sshd sur Leap 15.1

Répondre #5
Il manque la moitié de ton fichier sshd_config.
Dans ce que tu as posté aucun port ni adresse d'écoute n'est indiqué.

Autant pour moi, en effet j'ai modifié le post.

Les lignes non commentées (non préfixées d'un #) sont celles que j'ai modifiées chez moi. Avant de copier-coller, vérifie que ça correspond à ce que tu veux faire.

Chez moi tout était identique à part la ligne
PermitRootLogin prohibit-password
qui était positionnée sur "yes".
J'ai modifié, j'attends la fin d'un gros transfert de fichiers que je viens d'engager (500Go), je reboote et je teste  ;)

Re : Impossible de démarrer le service sshd sur Leap 15.1

Répondre #6
Est-ce que tu as vérifié ce que fais cette option ?
Si tu l'actives tu ne pourras pas te connecter en tant que root via mot de passe.
Si n'as pas d'autres utilisateurs et que tu n'as pas configuré ta connexion au serveur via clé SSH tu ne pourras pas accéder à ta machine.

Re : Impossible de démarrer le service sshd sur Leap 15.1

Répondre #7
C'est toi qui a ajouté les options de config des Ciphers, MACs et Key Exchange Algo ?
Elles ne sont pas présentes dans la config par défaut de ssh, peux-tu les commenter et voir si le dæmon démarre correctement ?

Re : Impossible de démarrer le service sshd sur Leap 15.1

Répondre #8
Est-ce que tu as vérifié ce que fais cette option ?

Si j'ai bien compris c'est pour avoir accès au serveur ssh en root. J'ai quand même testé de modifier l'option au cas où ça viendrait de ça, mais le serveur refuse toujours de démarrer. Je remets donc par défaut sur yes.

C'est toi qui a ajouté les options de config des Ciphers, MACs et Key Exchange Algo ?
Je ne pensais pas mais après quelques recherches je me rends compte que oui, j'avais dû dans un passé lointain changer le fichier car j'ai retrouvé ces lignes dans la doc ubuntu  :-[

Elles ne sont pas présentes dans la config par défaut de ssh, peux-tu les commenter et voir si le dæmon démarre correctement ?
C'est fait et le serveur ssh redémarre !  :)

Par contre x2go ne marche toujours pas. J'ai pourtant suivi la procédure, je reçois ce message juste après l'ouverture de la session :


J'ai suivi le tuto de fedora pour configurer x2go


EDIT: Je m'aperçois en fait qu'il s'agit juste d'un message d'avertissement. Si je ferme la fenêtre en appuyant sur "ok" je peux quand même me servir de ma session distante.
C'est donc simplement un bug logiciel j'imagine ?


En tout cas merci sogal pour ton aide :D .... Et pour corriger mes bêtises...  :-[

Re : Impossible de démarrer le service sshd sur Leap 15.1

Répondre #9
Ce n'est pas du tout un bug logiciel, ça te dit exactement ce qu'il se passe:

Le démon ssh n'est pas actif sur TON ORDINATEUR

il ne parle pas du serveur distant :)

Re : Impossible de démarrer le service sshd sur Leap 15.1

Répondre #10
Étrange, le module apparaît pourtant comme chargé sur le client (mais pas actif)  :
systemctl status sshd.service
● sshd.service - OpenSSH Daemon
     Loaded: loaded (/usr/lib/systemd/system/sshd.service; disabled; vendor preset: disabled)
     Active: inactive (dead)

Si je lui demande d'activer le service
systemctl enable sshd.service
Created symlink /etc/systemd/system/multi-user.target.wants/sshd.service → /usr/lib/systemd/system/sshd.service.

Le résultat reste le même : chargé mais inactif.
N'est-il pas étrange que je puisse me connecter sur le serveur et utiliser des commandes à distance alors que le service sshd n'est pas censé être actif ?

Re : Impossible de démarrer le service sshd sur Leap 15.1

Répondre #11
Pas du tout.

Sur le serveur, le dæmon sshd doit être à l'écoute puis que le client, via la commande ssh puisse s'y connecter.
Il n'est pas absolument pas nécessaire que le dæmon sshd soit actif sur le client pour qu'il puisse se connecter à celui du serveur.

D'après tes commandes, le dæmon sshd est maintenant programmé pour être démarré au prochain démarrage de ton système client. Mais comme tu n'as pas fait de

systemctl start sshd

cela n'est pas encore actif.

Re : Impossible de démarrer le service sshd sur Leap 15.1

Répondre #12
Après avoir activé le service, j'ai relancé status
systemctl status sshd.service
● sshd.service - OpenSSH Daemon
     Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: disabled)
     Active: active (running) since Sat 2020-05-02 19:56:59 CEST; 4s ago
   Main PID: 104220 (sshd)
      Tasks: 1 (limit: 19114)
     Memory: 1.8M
     CGroup: /system.slice/sshd.service
             └─104220 sshd: /usr/bin/sshd -D [listener] 0 of 10-100 startups

mai 02 19:56:59 PatrickII systemd[1]: Started OpenSSH Daemon.
mai 02 19:56:59 PatrickII sshd[104220]: Server listening on 0.0.0.0 port 22.
mai 02 19:56:59 PatrickII sshd[104220]: Server listening on :: port 22.

Qui me confirme bien que le service est actif.  ;)
Pourtant, toujours le même message sur x2go. J'ai lancé en console, pas de retour négatif :
x2goclient
x2go-INFO-1> "Starting X2Go Client 4.1.2.2..."
x2go-INFO-4> "Translator: :/i18n/x2goclient_fr_fr found."
x2go-WARNING-1> "Pas fatal : impossible de charger le traducteur : :/i18n/qt_fr_fr"
x2go-WARNING-1> "Tentative de chargement d'une langue moins prioritaire, si pertinent."
x2go-INFO-3> "X2Go Client démarré."
x2go-INFO-8> "Démarrage de la connexion au serveur : 192.168.8.100:22"
RESUMING SESSION is KDRIVE:  false
Generating public/private rsa key pair.
Your identification has been saved in /home/gleizoux/.x2go/ssh/gen/key.iCVXjB
Your public key has been saved in /home/gleizoux/.x2go/ssh/gen/key.iCVXjB.pub
The key fingerprint is:
SHA256:yywzt9DQHQZ/Fy2HWMcmYLOqhU/ztEBPxNnDVbL+Arg X2Go Client RSA user key
The key's randomart image is:
+---[RSA 4096]----+
|        .  .=B+==|
|         o o+oB==|
|          = + o* |
|       . = B o   |
|      . S O + .  |
|       = * * o . |
|      = B E o . .|
|       * .     . |
|        .        |
+----[SHA256]-----+