moshのssh-agent対応版を利用する

  • このエントリーをはてなブックマークに追加

moshのssh-agent対応は公式では対応していません。ただし、#696にて対応パッチが作られています。レポジトリはこちら
※port forward対応のパッチではありません。ssh-agent転送のパッチです。

前にMac<=>Amazon Linux1の間でこれをビルドして使っていたのですが、今回はWSL<=>Ubuntu18.04のためにビルドをしてみます。
protocol buffersはaptで入れます。(2020/03/09時点ではバージョンはv3.11.4でした。ubuntu18.04では3.0.0)

WSLはubuntu18.04を使っています。

WSL
sudo apt install -y autogen autoconf ncurses-dev libprotobuf-dev libprotoc-dev protobuf-compiler pkg-config

git clone https://github.com/rinne/mosh.git
cd mosh
./autogen.sh
./configure
make # only build
make check # with test
sudo make install

Server側もUbuntu18.04なので、上記と同じです。
あとは普通に実行。-Aオプションが使えるようになっています。

help
mosh --help | grep agent
-A --forward-agent enable ssh agent forwarding
mosh -A servername

もしServer側のバイナリを特定の場所にインストールしている場合は、mosh --server=/path/to/mosh-server servernameで。