トップ(最新)

nDiki

2006年6月15日 (木)

SSH port forwarding 経由での Unison を用いたファイル同期 このエントリーを含むはてなブックマーク

ノート PC ととあるプライベートネットワーク上のサーバとで Unison を使って同期しているディレクトリを、プライベートネットーワークの外から SSH 経由で port forwarding して同期できるようにしたくなった。

 今
 [ノート PC] -------------------- [サーバ]
               Unison with SSH   192.168.0.x

 これから
 [ノート PC] -------------------- [サーバ]
               Unison with SSH   192.168.0.x

 [ノート PC] -- [ゲートウェイ] -- [サーバ]
               gw.example.com    192.168.0.x
               Unison with SSH

@ 現在のノート PC 上での設定

 times = true
 root = /home/naney/somedir
 root = ssh://192.168.0.x//home/naney/somedir

 ignore = Name *~
 ignore = Name .*~
 ...

が 設定ファイル ~/.unison/server.prf の内容。

 unison server [options]

で同期している。

@ SSH port forwarding 経由で同期

新しくノート PC 上に設定ファイル ~/.unison/serverremote.prf を作成する

 times = true
 root = /home/naney/somedir
 root = ssh://localhost//home/naney/somedir
 rootalias = ssh://localhost//home/naney/somedir -> ssh://192.168.0.x//home/naney/somedir
 sshargs = -p 8022 -o HostKeyAlias=192.168.0.x

 ignore = Name *~
 ignore = Name .*~
 ...

SSH port forwarding を開いてから、上の設定ファイルを使って同期するシェルスクリプト unison-serverremote を書く

 #!/bin/sh
 ssh -f -L 8022:192.168.0.x:22 gw.example.com sleep 10
 unison serverremote $@

これで

 unison-serverremote

で、SSH port forwarding 経由で同期できるようになった。

スポンサード リンク


[ 6月15日全て ]

Related term

■よく検索されるキーワード

torrent(68) perl(60) windows(51) cvs(42) linux(41) 書き方(39) ganttproject(33) アジェンダ(26) debian(25) 使い方(24) 提案書(20) サンプル(19) java(19) ドラマ(17) tc-1(17) x31(16) 壁紙(16) google(16) ほぼ日手帳(16) subversion(15) バッグインバッグ(14) ヨドバシカメラ(14) 2009(14) 設定(14) firefox(13) 秋葉原(13) ssh(13) 修理(13) バッグ(13) インストール(12) 動画(12) svn(12) usb(12) 影舞(12) ファイル(11) rcs(11) ほぼ日(11) アジェンダとは(11) wiki(11) c#(10) ダイソー(10) thinkpad(10) centos(10) 無印(9) 価格(9) 画像(9) 手帳(9) activeperl(9) apache(9) 市原隼人(9) リフィル(9) ミノルタ(9) 冷蔵庫(9) 作り方(9) tortoisesvn(9) 大井町(9) ほぼ日手帳2009(8) gmail(8) 生年月日(8) truecrypt(8) mailpia(8) so905ics(7) cgi(7) スーベレーン(7) mew(7) spidermonkey(7) emacs(7) ご査収(7) ダウンロード(7) パスワード(7) テンプレート(7) cygwin(7) chrome(7) make(7) suunto(7) gimp(7) 評判(7) gtd(7) 写真(7) 方法(7)

この日記のはてなブックマーク数 Add to Google RSS

Process Time: 0.139437s / load averages: 0.48, 0.51, 0.47
nDiki by WATANABE Yoshimasa (profile)
Powered by DiKicker
Base theme by Nana (for tDiary)