tech:ssh
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
| tech:ssh [2025/07/23 14:43] – Jean-Baptiste | tech:ssh [2026/06/07 19:12] (Version actuelle) – modification externe 127.0.0.1 | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| + | < | ||
| + | {{tag> | ||
| + | |||
| + | # SSH | ||
| + | |||
| + | https:// | ||
| + | |||
| + | Voir | ||
| + | * http:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * http:// | ||
| + | |||
| + | Voir `man ssh_config` | ||
| + | |||
| + | `~/ | ||
| + | |||
| + | `~/ | ||
| + | ~~~ini | ||
| + | |||
| + | Host * | ||
| + | ServerAliveInterval 300 | ||
| + | ServerAliveCountMax 3 | ||
| + | ControlMaster auto | ||
| + | ControlPath ~/ | ||
| + | ControlPersist 4h | ||
| + | EscapeChar ~ | ||
| + | |||
| + | Host srvlnxvm1 | ||
| + | User root | ||
| + | HostName srvlnxvm1 | ||
| + | ProxyCommand ssh -W %h:%p srvlnxrbd | ||
| + | |||
| + | Host srvlnxdir1 | ||
| + | HostName srvlnxdir1 | ||
| + | LocalForward 1389 127.0.0.1: | ||
| + | LocalForward 1636 127.0.0.1: | ||
| + | # ExitOnForwardFailure yes | ||
| + | |||
| + | Host srvlnxvm2 192.168.22.42 | ||
| + | Hostname srvlnxvm2 | ||
| + | ProxyCommand ssh -W %h:%p srvlnxrbd | ||
| + | |||
| + | Host * | ||
| + | User root | ||
| + | |||
| + | Host gtw | ||
| + | Hostname 192.168.22.78 | ||
| + | PubkeyAuthentication=no | ||
| + | Port 6322 | ||
| + | #lftp sftp:// | ||
| + | |||
| + | Host 192.168.22.63 | ||
| + | Hostname 192.168.22.63 | ||
| + | ProxyCommand ssh -W %h:%p srvlnxrbd | ||
| + | ForwardAgent yes | ||
| + | # | ||
| + | |||
| + | Host test1 | ||
| + | User root | ||
| + | Hostname 192.168.2.41 | ||
| + | IdentityFile ~/ | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | Pour débugger ssh_config : | ||
| + | ~~~bash | ||
| + | ssh -G user@somehost.example.com | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ## Notes | ||
| + | |||
| + | |||
| + | / | ||
| + | |||
| + | - | ||
| + | |||
| + | Réutiliser la connexion existante au lieu de refaire une nouvelle connexion. Accélère | ||
| + | |||
| + | Source http:// | ||
| + | |||
| + | `~/ | ||
| + | ~~~ | ||
| + | Host * | ||
| + | | ||
| + | | ||
| + | | ||
| + | ~~~ | ||
| + | |||
| + | Pour cette connexion (temporairement) ne pas utiliser l' | ||
| + | |||
| + | ~~~bash | ||
| + | ssh -o " | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ## SSH Escape Sequences (aka Kill Dead SSH Sessions) | ||
| + | |||
| + | `~/ | ||
| + | ~~~ | ||
| + | Host * | ||
| + | EscapeChar ~ | ||
| + | ~~~ | ||
| + | |||
| + | ~~~ | ||
| + | Supported escape sequences: | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | ~V/v - decrease/ | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | (Note that escapes are only recognized immediately after newline. | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | |||
| + | ## Sécurité | ||
| + | |||
| + | ~~~bash | ||
| + | ssh-keygen -G moduli-3072.candidates -b 3072 | ||
| + | ~~~ | ||
| + | |||
| + | Voir : https:// | ||
| + | |||
| + | `/ | ||
| + | |||
| + | ## Pb déconnexion | ||
| + | |||
| + | Déconnexion SSH au bout de 30 secondes avec `Write Failed: broken pipe` | ||
| + | |||
| + | Doublon d' | ||
| + | |||
| + | |||
| + | ## Autres | ||
| + | |||
| + | ssh force password / Ne pas utiliser la clef mais demander le mot de passe | ||
| + | ~~~bash | ||
| + | ssh -o PreferredAuthentications=password -o PubkeyAuthentication=no 192.168.1.22 | ||
| + | ~~~ | ||
| + | |||
| + | A l' | ||
| + | ~~~bash | ||
| + | ssh -o PasswordAuthentication=no -o ChallengeResponseAuthentication=no -o PreferredAuthentications=publickey -o StrictHostKeyChecking=no -o ConnectTimeout=2 -o BatchMode=yes 192.168.1.22 | ||
| + | ~~~ | ||
