35
30

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

sshの接続を早くする(ControlMaster)

Last updated at Posted at 2014-02-14
.ssh/config
Host *
    ControlMaster auto
    ControlPath ~/.ssh/mux-%r@%h:%p
    ControlPersist 30m
  • と書いておけば、2本目以降のsshの接続が一瞬です。(1本目のssh接続を使って接続する。)
  • 接続まで3秒くらいかかるサーバ(多段接続していたらチョイチョイある)に何度も入る場合便利。
  • LocalCommandは1本目のみ実行される。

注意点

  • localforwarding (-NLのこと) を使う場合、control-cで終了させても接続が残るのでハマらないように。
    • killall sshすればよい。

コメントの注意

.ssh/config
 Host *
    ControlMaster auto
    ControlPath ~/.ssh/mux-%r@%h:%p
    ControlPersist 30m
+    # n*
  • なぜか* が解釈されて予期せぬ動作をするので、コメントに * を書かないこと

GSSAPIAuthentication no

ssh接続に時間がかかる。
ssh -vで確認したところ以下出力あり。

debug1: Next authentication method: gssapi-with-mic
debug1: Unspecified GSS failure. Minor code may provide more information
No Kerberos credentials available
debug1: Unspecified GSS failure. Minor code may provide more information
No Kerberos credentials available
debug1: Unspecified GSS failure. Minor code may provide more information
debug1: Unspecified GSS failure. Minor code may provide more information
No Kerberos credentials available

~/.ssh/config
Host *
    GSSAPIAuthentication no

一瞬で接続できるようになった。

35
30
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
35
30

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?