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
3 Opérations à effectuer
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
sudo echo >/etc/ssh/ssh_2/sshd_config <<EOF ChallengeResponseAuthentication no Port 2230 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
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
Lancer et vérifier ce nouveau service
- Prise en compte du nouveau service
sudo systemctl daemon-reload sudo systemctl enable ssh-second sudo systemctl start ssh-second
article/ssh/lancer_un_deuxieme_service_ssh_sous_debian.1772805156.txt.gz · Dernière modification : de estro
