Как применить некоторые настройки к хостам SSH, исключив один другой хост?

Как применить некоторые настройки к хостам SSH, исключив один другой хост?

У меня относительно полная настройка для моего ~/.ssh/config. Вот что сверху:

Host *
   ControlMaster auto
   ControlPath /tmp/ssh_mux_%h_%p_%r
   ControlPersist 24h
   BatchMode yes
   Ciphers blowfish-cbc
   Compression yes
   VisualHostKey yes

Я хочу сделать так, чтобы ControlMasteretc не распространялись на github; они, по-видимому, активно отключают эти постоянные соединения, что я понимаю и уважаю.

Итак, для ясности:

 $ rm /tmp/ssh_mux_*
 $ ssh [email protected]
   PTY allocation request failed
   Hi frioux! You've successfully authenticated, but GitHub does not provide shell access.
   Shared connection to github.com closed.

 $ ls /tmp/ssh_mux_*
   /tmp/ssh_mux_github.com_22_git

Итак, я прочитал кое-какую документацию, задал вопрос в IRC, и вот что у меня получилось:

Host !github.com
   ControlMaster auto
   ControlPath /tmp/ssh_mux_%h_%p_%r
   ControlPersist 24h

Host *
   BatchMode yes
   Ciphers blowfish-cbc
   Compression yes
   VisualHostKey yes

Так что теперь github правильно не использует ControlMaster:

 $ rm /tmp/ssh_mux_*
 $ ssh [email protected]
   Host key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48
   +--[ RSA 2048]----+
   |        .        |
   |       + .       |
   |      . B .      |
   |     o * +       |
   |    X * S        |
   |   + O o . .     |
   |    .   E . o    |
   |       . . o     |
   |        . .      |
   +-----------------+

   PTY allocation request failed
   Hi frioux! You've successfully authenticated, but GitHub does not provide shell access.
   Shared connection to github.com closed.

 $ ls /tmp/ssh_mux_*

Но и все остальное тоже:

 $ rm /tmp/ssh_mux_*
 $ ssh cs ls
   Host key fingerprint is 89:d1:40:7f:0d:11:28:10:ce:23:e6:a9:12:9d:a1:5b
   +--[ RSA 2048]----+
   |    o+o  .+o     |
   |   o  .+.  o     |
   |  + + ..o . .    |
   | = = . o o       |
   |o E   . S        |
   | =               |
   |+                |
   |.                |
   |                 |
   +-----------------+

   /home/frew
   bin
   code
   irclogs
   lib
   out
   test

 $ ls /tmp/ssh_mux_*

Я попытался создать строку хоста Host !github.com, *, Host *, !github.comно, насколько я могу судить, когда я это делаю, она всегда применяется к github.

Как я могу делать то, что хочу?

решение1

Шаблоны после этого Hostразделяются пробелами, а не запятыми, поэтому это должно сработать:

Host * !github.com
    ControlMaster auto
    ControlPath /tmp/ssh_mux_%h_%p_%r
    ControlPersist 24h

решение2

rudi_s на IRC помог мне найти решение:

Host github.com
   ControlMaster  no
   ControlPath    no
   ControlPersist no

Host *
   ControlMaster auto
   ControlPath /tmp/ssh_mux_%h_%p_%r
   ControlPersist 24h
   BatchMode yes
   Ciphers blowfish-cbc
   Compression yes
   VisualHostKey yes

Связанный контент