Outils pour utilisateurs

Outils du site


article:ssh:lancer_un_deuxieme_service_ssh_sous_debian

Ceci est une ancienne révision du document !


SSH :Lancer un deuxième service ssh sous Debian

retour_haut_de_page

Modèle nouvelle configuration ssh

  • Créer le dossier du nouveau service ssh
    sudo mkdir /etc/ssh/ssh_2/ 
  • Créer et adapter le modèle de fichier de configuration du nouveau service
    echo >/etc/ssh/ssh_2/sshd_config <<EOF
    ChallengeResponseAuthentication no
    UsePAM no
    X11Forwarding yes
    PrintMotd yes
    AcceptEnv LANG LC_*
    Subsystem       sftp    /usr/lib/openssh/sftp-server
    IgnoreRhosts yes
    IgnoreUserKnownHosts no
    StrictModes yes
    PubkeyAuthentication yes
    RSAAuthentication yes
    PermitRootLogin without-password
    PermitEmptyPasswords no
    PasswordAuthentication no
    GatewayPorts no
    AllowTcpForwarding yes
    KeepAlive yes
    Protocol 2 
    EOF 

retour_haut_de_page

Création d'un nouveau service associé à cette configuration

  • Créer le fichier /etc/systemd/system/ssh-second.service
    cat >/etc/systemd/system/ssh-second.service <<EOF
    [Unit]
    Description=OpenSSH server (second instance)
    After=network.target auditd.service
    Wants=network-online.target
     
    [Service]
    ExecStart=/usr/sbin/sshd -D -f /etc/ssh/sshd_2/sshd_config
    ExecReload=/bin/kill -HUP $MAINPID
    Restart=on-failure
    # Séparer le PID et le socket si besoin
    PIDFile=/run/sshd_second.pid
     
    [Install]
    WantedBy=multi-user.target
    EOF

retour_haut_de_page

Lancer et vérifier ce nouveau service

  • Prise en compte du nouveau service
    sudo systemctl daemon-reload
    sudo systemctl enable --now ssh-second
article/ssh/lancer_un_deuxieme_service_ssh_sous_debian.1772804574.txt.gz · Dernière modification : de estro

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki