#author("2022-09-15T08:11:14+09:00","default:nobuoki","nobuoki")
#author("2022-09-15T08:11:41+09:00","default:nobuoki","nobuoki")
- どの環境でも ~/.ssh/config を統一したい
- ssh の多重化をしたい
-- だけど MSYS2(やCygwin)は ssh の多重化が出来ないので何とかしたい

という人向けです

* ~/.ssh/config [#m710b778]

#prism(bash){{{
# MSYS2に特化した設定
Match Exec "uname | grep -qE '(MSYS|MINGW)'"
  ControlMaster no
Match All
# 以下、共通の設定(MSYS2は先に記載した ControlMaster が採用される)
ControlPath ~/.ssh/mux/%C
ControlMaster auto
ControlPersist 1d
}}}

* ポイント [#edc96a94]
- ssh_configは先勝ちなので、先に MSYS2 用の設定(ControlMaster)を設定する
- (表現が変だけど)''Match Exec hoge'' を閉じるには ''Match All'' が使える
-- あるいは ''Match Host *'' でもOK(こっちの方が見慣れてて良いかも)

* 参考 [#p9d59447]
- man ssh_config
- [[SSHの多重接続について – Siguniang's Blog>https://siguniang.wordpress.com/2013/11/30/notes-on-ssh-multiplexing/]]
- [[最強のSSH踏み台設定 - Qiita>https://qiita.com/kawaz/items/a0151d3aa2b6f9c4b3b8#comment-8932a2c6a4d83d519bd8]]
- [[sshd_configの設定で「Match条件の終わり方」について教えて... - Yahoo!知恵袋>https://detail.chiebukuro.yahoo.co.jp/qa/question_detail/q11166519236?__ysp=c3NoX2NvbmZpZyAibWF0Y2ggYWxsIg%3D%3D]]

トップ   編集 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS