トップ(最新)

nDiki : 2006年06月15日

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日全て ]

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

torrent(173) expressions(80) 竹内まりや(58) x31(25) ドラマ(23) linux(23) 手帳(21) 壁紙(21) perl(21) windows(20) 動画(19) wiki(17) porter(17) debian(16) 使い方(16) 画像(15) thinkpad(15) 作り方(15) gmail(14) usb(14) 秋葉原(13) ヨドバシ(13) ほぼ日手帳(13) 提案書(12) 活用(12) 竹内(12) 古川小百合(12) 修理(12) ノート(11) 無印(11) ヨドバシカメラ(11) nikon(11) 書き方(10) ダイソー(10) 万年筆(10) 生年月日(10) 大井町(10) ミニ6穴(9) ほぼ日(9) tc-1(9) 冷蔵庫(9) 設定(9) ニコン(9) java(9) mp3(8) 故障(8) 方眼(8) xp(8) 日誌(8) 感想(8) カメラ(8) allinanchor:*.torrent(8) バッグ(8) firefox(7) インストール(7) キーボード(7) mixi(7) 無料(7) リフィル(7) 小林麻耶(7) nikkor(7) ジョイントラック(7) madwifi(7) 原田夏希(7) skype(6) 変更(6) 三条まゆみ(6) ペンケース(6) web(6) emacs(6) home(6) ポーター(6) 2009(6) itunes(6) a6(6) 無印良品(6) デジカメ(6) finepix(6) 無線lan(6) 評判(6)

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

Process Time: 0.259102s / load averages: 0.89, 1.08, 1.20
nDiki by WATANABE Yoshimasa (profile)
Powered by DiKicker
Base theme by Nana (for tDiary)