
我的~/.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;他們顯然主動斷開了這些持久的聯繫,我理解並尊重這一點。
所以要明確的是:
$ 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