다른 호스트 하나를 제외한 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

ControlMaster등이 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

IRC의 rudi_s는 제가 해결책을 찾는 데 도움을 주었습니다.

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

관련 정보