Bonsoir,
Je reviens vers vous afin de vous demander conseil. Après le mode rescue, j'ai pu me reconnecter, j'ai remis l'ancien /etc/ssh/sshd_config mais en SSH restart il y a des erreurs. Voir ci-dessous. Je pense que je me dois de réinstaller openssh-server ainsi que le client. Comment puis-je faire ? Désinstaller et ensuite passer en mode rescue et réinstaller ? Merci pour vos suggestions. Bien cordialement.

service ssh restart
Job for ssh.service failed because the control process exited with error code.
See "systemctl status ssh.service" and "journalctl -xe" for details.
root@..........:~# systemctl status ssh.service
 ssh.service - OpenBSD Secure Shell server
   Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Fri 2020-04-24 12:05:44 CEST; 1min 52s ago
  Process: 25882 ExecStart=/usr/sbin/sshd -D $SSHD_OPTS (code=exited, status=0/SUCCESS)
  Process: 6876 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=255)
 Main PID: 25882 (code=exited, status=0/SUCCESS)
    Tasks: 4 (limit: 4915)
   CGroup: /system.slice/ssh.service
           ├─ 6980 systemctl status ssh.service
           ├─ 6981 pager
           ├─19579 sshd: root@pts/2
           └─20098 -bash
ssh.service: Control process exited, code=exited status=255
systemd[1]: Failed to start OpenBSD Secure Shell server.
systemd[1]: ssh.service: Unit entered failed state.
systemd[1]: ssh.service: Failed with result 'exit-code'.
systemd[1]: ssh.service: Service hold-off time over, scheduling restart.
systemd[1]: Stopped OpenBSD Secure Shell server.
systemd[1]: ssh.service: Start request repeated too quickly.
systemd[1]: Failed to start OpenBSD Secure Shell server.
systemd[1]: ssh.service: Unit entered failed state.
systemd[1]: ssh.service: Failed with result 'exit-code

tu peut nous poster ton fichier sshd_config ?

# Package generated configuration file
# See the sshd_config(5) manpage for details

# What ports, IPs and protocols we listen for
Port 22
# Use these options to restrict which interfaces/protocols sshd will bind to
#ListenAddress ::
#ListenAddress 0.0.0.0
Protocol 2
# HostKeys for protocol version 2
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
#Privilege Separation is turned on for security
UsePrivilegeSeparation yes

# Lifetime and size of ephemeral version 1 server key
KeyRegenerationInterval 3600
ServerKeyBits 1024

# Logging
SyslogFacility AUTH
LogLevel INFO

# Authentication:
LoginGraceTime 120
#PermitRootLogin without-password
PermitRootLogin yes
StrictModes yes
RSAAuthentication yes
PubkeyAuthentication yes
#AuthorizedKeysFile     %h/.ssh/authorized_keys

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

# To enable empty passwords, change to yes (NOT RECOMMENDED)
PermitEmptyPasswords no

# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
ChallengeResponseAuthentication no

# Change to no to disable tunnelled clear text passwords
#PasswordAuthentication yes

# Kerberos options
#KerberosAuthentication no

#KerberosGetAFSToken no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes

X11Forwarding yes
X11DisplayOffset 10
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
#UseLogin no

#MaxStartups 10:30:60
#Banner /etc/issue.net

# Allow client to pass locale environment variables
AcceptEnv LANG LC_*
Subsystem sftp /usr/lib/openssh/sftp-server


# 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
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-sh$
KexAlgorithms diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sh$

les dernières lignes s’arrêtent là ou elles continuent ?

Hello MattProd
Merci pour ta réponse. Tu as le fichier entier jusqu'à sa fin.

Je pense que les 2 dernières lignes sont pas fini ce qui doit provoquer une erreur dans ssh

Ok MattProd ! Le cryptage ! J'ai remplacé les dernières lignes par ceci. J'ai pu faire un reload SSH pour la première fois. Je vous tiens au courant tous pour la suite ! Merci à vous

Ciphers aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,chacha20-poly1305@openssh.com,aes256-gcm@openssh.com
HostKeyAlgorithms ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-rsa,ssh-dss,ssh-ed25519
KexAlgorithms curve25519-sha256@libssh.org,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,diffie-hellman-group16-sha512
MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,umac-128-etm@openssh.com

Bonjour à tous,
Voici quelques news ! Dès que je tente un changement au niveau de /etc/ssh/sshd_config toujours dans l’objectif de bloquer l’user dans son home en sftp. He bien je ne peux plus me connecter en SSH et en FTP ; comme au début de cet fil de discussion. J’ai suivi ce tuto
https://mondedie.fr/d/840-tuto-chrooter-les-utilisateurs-dans-leur-home-en-sftp

Merci pour vos réponses. Bien cordialement

Modification !!!!

Match user user1,user2,user3,user4
         ChrootDirectory /home/%u
5 jours plus tard

Bonsoir à tous,
/etc/ssh/sshd_config J’ai retiré les lignes de cryptage après le #UsepAM yes Depuis j’ai pu réaliser un service ssh restart sans failed ! Je me suis inspiré de ce tuto afin d’atteindre l’objectif de départ pour le SFTP. Tout est Ok, chaque user se retrouve dans son répertoire. Mais le problème c’est que rtorrent ne veux plus redémarrer. Je ne le retrouve plus dans le home de l’utilisateur. Dans l’interface voici l’erreur. Le GID numérique serait-il LE responsable ?
Lien incorrect avec rTorrent. Vérifier qu'il est bien en cours d'exécution. Vérifier la configuration de $scgi_port et de $scgi_host dans config.php et scgi_port dans le fichier de configuration de rTorrent

Je vais tenter de récupérer quelques fichiers si j’ai de nouveau accès a rtorrent et en liaison avec ce fil, je pense que ce serait une excellente idée de refaire une toute belle installation sous Debian 10. Dans ce cas auriez vous une suggestion d’un tuto pour une seedbox. Merci pour vos conseils. Bien cordialement

Je n’ai pas utilisé le script.
http://www.kitpages.fr/fr/cms/193/installer-un-sftp-avec-chroot-sur-debian

    chlotus rTorrent n'a l'air tout simplement pas démarré!

    Que donnent les commandes "systemctl status rtorrent" et "cat /var/log/daemon.log | grep rtorrent" ?

    Si tu sais quel utilisateur est censé démarrer ce service, tu peux essayer de faire : "sudo -u <user> rtorrent" et voir le message d'erreur au démarrage s'il ne veut plus démarrer.

    Tiens nous au courant

      Luth1ng
      Merci pour ton message. Voici quelques réponses !

      systemctl status rtorrent
      Unit rtorrent.service could not be found.

      cat /var/log/daemon.log | grep rtorrent
      Apr 28 12:38:23 GRE chlotus-rtorrent[935]: Starting rtorrent...
      May 1 11:27:52 GRE systemd[1]: session-c2.scope: Killing process 1375 (rtorrent main) with signal SIGTERM.
      May 1 11:29:00 GRE chlotus-rtorrent[1367]: Starting rtorrent...
      May 1 18:11:21 GRE chlotus-rtorrent[1397]: Starting rtorrent...
      May 2 09:27:59 GRE chlotus-rtorrent[29016]: Stopping rtorrent...
      May 2 09:27:59 GRE chlotus-rtorrent[29021]: Starting rtorrent...

      -u chlotus rtorrent
      -bash: -u : commande introuvable

      rtorrent
      (17:33:54) Using 'epoll' based polling.
      (17:33:54) Using 'epoll' based polling.
      (17:33:54) Using 'epoll' based polling.
      (17:33:54) Could not read resource file: ~/.rtorrent.rc
      [Throttle off/off KB] [Rate 0,0/ 0,0 KB] [Port: 6901] [U 0/0] [D 0/0] [H 0/32] [S 0/1/768] [F 0/128]

        chlotus tu n'as pas créé de service systemd apparemment.
        La commande service rtorrent status renvoie quoi ?

        J'ai l'impression que la commande "sudo -u chlotus rtorrent" a foiré :

        -u chlotus rtorrent
        -bash: -u : commande introuvable

        Du coup t'as du le lancer en root et le rtorrent n'a pas pu accéder au fichier .rtorrent.rc puisque le chemin est relatif :

        (17:33:54) Could not read resource file: ~/.rtorrent.rc

        As-tu bien "sudo" d'installé ?
        Sinon connecte toi avec ton user chlotus et lance directement la commande rtorrent pour voir ce qu'il se passe

        sudo -u chlotus rtorrent
        (19:21:53) Using 'epoll' based polling.
        (19:21:53) Using 'epoll' based polling.
        (19:21:53) Using 'epoll' based polling.
        (19:21:53) Could not read resource file: ~/.rtorrent.rc
        [Throttle off/off KB] [Rate 0.0/ 0.0 KB] [Port: 6913] [U 0/0] [D 0/0] [H 0/3 [Throttle off/off KB] [Rate 0.0/ 0.0 KB] [Port: 6932] [U 0/0] [D 0/0] [H 0/3

        Je n'arrive pas à me connecter avec l'user chlotus putty fatal error remote side unexpecteddly closed networkconnection
        Merci pour ta réponse.

          chlotus tu n'accèdes à ton serveur que via ton compte root ?

          tu essaies de te connecter comment avec ton user chlotus ? directement en SSH ?

          Non j'ai deux utilisateurs l'un fonctionne parfaitement alors que chlotus ne fonctionne pas !

          chlotus si tu fais "su - chlotus" tu arrives à te connecter?

          Hello
          Merci pour ton aide ! le problème est venu dès que j’ai créé deux nouveaux users (2) avec les droits d’accès dans le home directory. Depuis j’ai retiré le groupe ami et ses deux users.

          su - chlotus
          No directory, logging in with HOME=/
          chlotus@GRE:/$
          
          cat /etc/passwd
          chlotus:x:1000:1000::/home/chlotus:/bin/bash
          
          useradd alan --gid amis --groups amis -m --shell /bin/false
          
          chown root /home/alan
          chmod go-w /home/alan
          
          mkdir /home/alan/notes
          chown alan:amis /home/alan/notes
          chmod ug+rwX /home/alan/notes

            chlotus
            quelles permissions as-tu attribué aux dossiers /home/alan et /home/chlotus ?

            ls -lisa /home/alan

            ls -lisa /home/chlotus

            chlotus@GRE:/root$ ls -lisa /home/chlotus
            ls: impossible d'accéder à '/home/chlotus': Aucun fichier ou dossier de ce type

            Comme exprimé dans mon message précédent j'ai supprimé les deux users dont alan.