LS-GL: debian: rsync のインストール


昨日設定したスクリプトで作成したアーカイブは、 rsync を用いて 赤いLinkStationにコピーする。

rsync のインストール

ude:~# apt-get update
	:
	:
ude:~# apt-get install rsync
Reading Package Lists... Done
Building Dependency Tree... Done
Suggested packages:
  ssh
The following NEW packages will be installed:
  rsync
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 208kB of archives.
After unpacking 434kB of additional disk space will be used.
Get:1 http://ftp.jp.debian.org sarge/main rsync 2.6.4-6 [208kB]
Fetched 208kB in 9s (21.5kB/s)
Selecting previously deselected package rsync.
(Reading database ... 7644 files and directories currently installed.)
Unpacking rsync (from .../archives/rsync_2.6.4-6_arm.deb) ...
Setting up rsync (2.6.4-6) ...
rsync daemon not enabled in /etc/default/rsync

ude:~#

rsync の設定は?

rsync daemon not enabled in /etc/default/rsync とのことなので、/etc/default/rsync を見てみる。
どうやったら inetd から起動できる?
ude:~# cat /etc/default/rsync
# defaults file for rsync daemon mode

# start rsync in daemon mode from init.d script?
#  only allowed values are "true", "false", and "inetd"
#  Use "inetd" if you want to start the rsyncd from inetd,
#  all this does is prevent the init.d script from printing a message
#  about not starting rsyncd (you still need to modify inetd's config yourself).
RSYNC_ENABLE=false

# which file should be used as the configuration file for rsync.
# This file is used instead of the default /etc/rsyncd.conf
# Warning: This option has no effect if the daemon is accessed
#          using a remote shell. When using a different file for
#          rsync you might want to symlink /etc/rsyncd.conf to
#          that file.
# RSYNC_CONFIG_FILE=

# what extra options to give rsync --daemon?
#  that excludes the --daemon; that's always done in the init.d script
#  Possibilities are:
#   --address=123.45.67.89              (bind to a specific IP address)
#   --port=8730                         (bind to specified port; default 873)
RSYNC_OPTS=''

# Don't forget to create an appropriate config file,
# else the daemon will not start.
ude:~#
RSYNC_ENABLE=inetd と書けばいいだけかと思ったら、 you still need to modify inetd's config yourself だと。

rsync の設定

/etc/default/rsync の修正

/etc/init.d/rsync を実行しても、 何もしないし警告も出さないようにするためには、 /etc/default/rsync に RSYNC_ENABLE=inetd と書くらしい。
ude:/etc/init.d# cd
ude:~# cd /etc/default/
ude:/etc/default# mv rsync rsync.orig
ude:/etc/default# cp rsync.orig rsync
ude:/etc/default# ls -l rsync*
-rw-r--r--  1 root root 1091 Jan 13 13:22 rsync
-rw-r--r--  1 root root 1091 May 11  2005 rsync.orig
ude:/etc/default# vi rsync
	:
	:
ude:/etc/default# diff rsync.orig rsync
8c8
< RSYNC_ENABLE=false
---
> RSYNC_ENABLE=inetd
ude:/etc/default#

/etc/rsyncd.conf の作成

ude:/etc# vi rsyncd.conf
ude:/etc# cat rsyncd.conf
[Backup]
        path = /mnt/Backup
        hosts allow = 192.168.1.0/24
ude:/etc# 
こんなもの?

inetd の設定

/etc/services の修正

inetd.conf への登録の前に、 rsync が /etc/services にあるか確認する
ude:/etc/default# grep rsync /etc/services
rsync           873/tcp
rsync           873/udp
ude:/etc/default#
あるある。

/etc/inetd.conf の修正

inetd から rsync を起動する設定を追加する
ude:/etc/default# cd /etc/
ude:/etc# mv inetd.conf inetd.conf.orig
ude:/etc# cp inetd.conf.orig inetd.conf
ude:/etc# ls -l inetd.conf*
-rw-r--r--  1 root root 1337 Jan 13 13:28 inetd.conf
-rw-r--r--  1 root root 1337 Jan  8 13:56 inetd.conf.orig
ude:/etc# vi inetd.conf
	:
	:
ude:/etc# diff -c inetd.conf.orig inetd.conf
*** inetd.conf.orig     Mon Jan  8 13:56:42 2007
--- inetd.conf  Sat Jan 13 13:29:26 2007
***************
*** 42,45 ****
  #:HAM-RADIO: amateur-radio services

  #:OTHER: Other services
!
--- 42,45 ----
  #:HAM-RADIO: amateur-radio services

  #:OTHER: Other services
! rsync   stream  tcp     nowait  root    /usr/sbin/tcpd /usr/bin/rsync --daemon
ude:/etc#

reload

ude:~# /etc/init.d/inetd reload
Reloading internet superserver: inetd.
ude:~#
これで LS-GL 側の設定は終わり。

rsync の実行

赤い LinkStation から rsync を実行する
[root@red /root]# cd /mnt/home/Backup/
[root@red Backup]# rsync -rtuvpogtlH rsync://ude/Backup/ude .
receiving file list ... done
ude/
ude/ude.0701/
	:
ude/ude.0701/ude-yamasita.Thu.tar.gz
wrote 522 bytes  read 110972283 bytes  4351874.71 bytes/sec
total size is 110956653  speedup is 1.00
[root@red Backup]#



LS-GL: debian: バックアップ
ハックの記録
LinkStation/玄箱 をハックしよう

LS-GL: debian: DHCP サーバ

Copyright (C) 2007 Yasunari Yamashita. All Rights Reserved.
yasunari @ yamasita.jp 山下康成@京都府向日市