[Memo2011][ITPASS] ika 構築作業ログ 20 (home領域の転送1)

11/11/03 に home 領域の ika から tako への転送を関, 大西で行った.(ロガー: 大西)

[ITPASSサーバ構築ドキュメント へ戻る]

home 領域を ika から tako へ転送

サーバ交換作業当日にも同様の作業を行うが, その際の時間を短縮するために行った.

公開鍵認証の際のセキュリティ設定の変更 (通信許可)

まず tako 側の ika に対する通信許可の設定を行う.

最近の OpenSSH では, デフォルトでは root のログインを許可しないため, 設定を変更した. tako の /etc/ssh/sshd_config で,

PermitRootLogin no

という部分を

PermitRootLogin yes

に変更した. その後,

tako# /etc/init.d/ssh restart

として設定を反映した. これにより, root のログインを許可した.

rsync で転送されるファイルの確認

/root/.ssh/ の秘密鍵でログインするため, まず以下の作業を行った.

ika$ sudo -s -H
ika# cd /root  

いきなり rsync コマンドを実行すると予期せぬ間違い (転送元と転送先の設定を間違って, 転送先のファイルを全て消してしまう等) が起こりうるため, まずは rsync コマンドに -n オプションをつけて実行した. -n オプションをつけて実行すると, 実際のファイルの転送は行わずに, 転送されるはずのファイルのリストが出力される.

  • rsync する際, gate の home 領域や, tako のみに存在する chikuwa* の home, aquota.user ファイルまで ika に同期してしまわないよう オプション --exclude で除外した.
  • 外部記憶装置にあるファイルが転送されることのないように -x というオプションを加えた.
  • ここでは一度ファイルリストを /tmp ディレクトリ以下に出力し, 確認してから実際の転送を行うこととした.
  • まずはマニュアルに書かれている通りにコマンドを実行した.

    ika-itpass:~# rsync -n -av --delete -e ssh --exclude chikuwa* -x   
                 --exclude=aquota.user --exclude=gate /home/tako-itpass.scitec.kobe-u.ac.jp: 
                 /home/ 2>&1 | tee /tmp/rsync_ika2tako.log

ここでは 3 行に分けて書いているが, 実際には 1 行で入力した. なお, rsync に関するオプション (-av, --delete, -e 等) については, rsync(1) 等を参照した.

上記コマンドを実行したところ, 以下のようなメッセージが出た

sending incremental file list
rsync: link_stat "/home/tako-itpass.scitec.kobe-u.ac.jp:" failed: No such file or directory (2)
sent 18 bytes  received 12 bytes  60.00 bytes/sec
total size is 0  speedup is 0.00 (DRY RUN)
rsync error: some files could not be transferred (code 23) at main.c(1058) [sender=3.0.3]

そこでマニュアルのコマンドを見直すと, スペースを入れる位置がおかしいようだったので

ika-itpass:~# rsync -n -av --delete -e ssh --exclude chikuwa* -x   
             --exclude=aquota.user --exclude=gate /home/ tako-itpass.scitec.kobe-u.ac.jp:/home/ 
             2>&1 | tee /tmp/rsync_ika2tako.log

というふうに変更して再び実行した. すると,

Warning: the RSA host key for 'tako-itpass.scitec.kobe-u.ac.jp' differs 
from the key for the IP address '133.30.109.21'
Offending key for IP in /root/.ssh/known_hosts:1
Matching host key in /root/.ssh/known_hosts:6
Are you sure you want to continue connecting (yes/no)? yes
root@tako-itpass.scitec.kobe-u.ac.jp's password: 
root@tako-itpass.scitec.kobe-u.ac.jp's password: Permission denied, please try again.
root@tako-itpass.scitec.kobe-u.ac.jp's password: Permission denied, please try again.
Permission denied (publickey,password).
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(635) [sender=3.0.3]

と表示された. そこで /root/.ssh/known_hosts のバックアップを /root/.ssh/known_hostsorg にとった上で1 行目を削除し, 再び上記のコマンドを実行すると

Warning: Permanently added the RSA host key for IP address 
'133.30.109.21' to the list of known hosts.
root@tako-itpass.scitec.kobe-u.ac.jp's password: 
Permission denied, please try again.

となった. 再度同じコマンドを実行すると, Warning: 以下のメッセージは出なくなったが, パスワードを入力しても Permission denied となる.

この問題に関しては明日の作業にて解決を図る.

Last modified:2011/11/03 23:15:39
Keyword(s):
References:[[ITPASS2011]2011年度サーバ構築ログ]