---
slug: "i2cssh-bastion-xt"
title: "i2cssh で踏み台経由のログインを行う"
description: "i2cssh コマンドで、踏み台サーバー (Bastion / Jump host) 経由で複数台のサーバーに同時 SSH 接続するための `~/.i2csshrc` 設定例。"
url: "https://www.ytyng.com/blog/i2cssh-bastion-xt"
publish_date: "2020-08-21T08:19:48Z"
created: "2020-08-21T08:19:48Z"
updated: "2026-05-11T13:09:12.083Z"
categories: ["mac"]
keywords: ""
featured_image_url: "https://media.ytyng.com/resize/20230812/dfecc26041724eb0ac51d3712333d3a9.png.webp?width=768"
has_video: false
has_music: false
video_urls: []
music_urls: []
lang: "ja"
---

# i2cssh で踏み台経由のログインを行う

<p>i2cssh は、iterm2 で複数サーバに同時にログインし、SSHペインを自動的に並べて同時操作ができるようになるツールです。</p>
<p><a href="https://github.com/wouterdebie/i2cssh">https://github.com/wouterdebie/i2cssh</a></p>
<p></p>
<p>複数操作する対象のサーバに、同じ踏み台経由でログインするには</p>
<pre>i2cssh -Xt=user@bastion.example.com "ssh <a href="mailto:user@server1.example.com&quot;">user@server1.example.com"</a> "ssh <a href="mailto:user@server2.example.com&quot;">user@server2.example.com"</a></pre>
<p>とします。</p>
<p></p>
<p>python fabric でやるなら</p>
<pre><span>if </span><span>getattr</span>(env, <span>'gateway'</span>):<br />    local(<span>'i2cssh -Xt={} {}'</span>.format(<br />        env.gateway,<br />        <span>' '</span>.join(<span>'"ssh {}@{}"'</span>.format(env.user, h)<br />                 <span>for </span>h <span>in </span>env.hosts)))</pre>
<p></p>
<p>こんな感じですね</p>
