
私の のセットアップは比較的充実しています~/.ssh/config
。一番上に表示されているのがこれです:
Host *
ControlMaster auto
ControlPath /tmp/ssh_mux_%h_%p_%r
ControlPersist 24h
BatchMode yes
Ciphers blowfish-cbc
Compression yes
VisualHostKey yes
ControlMaster
etc が github に適用されないようにしたいと思います。どうやら 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