% % proftpd 導入ドキュメント % % 2001/04/19 Manabu YAMADA % % 1) パッケージのインストール # apt-get install proftpd ..... Fetched 423kB in 0s (4010kB/s) 未選択パッケージ proftpd を選択しています。 (データベースを読み込んでいます... 現在 42914 個の ファイルとディレクトリがインストールされています。) (.../proftpd_1.2.0pre10-2.0potato1_alpha.deb から) proftpd を展開しています... proftpd (1.2.0pre10-2.0potato1) を設定しています ... Enable anonymous ftp access [y/N]? <-- y (anonymous を許可する) Addiing ftp user to the system ... システムユーザ ftp を追加しています... グループ ftp に新しいユーザ 101 (nogroup) を追加しています。 ホームディレクトリ /home/ftp は既に存在します。 /usr/share/doc/proftpd/examples/welcome.msg -> /home/ftp/welcome.msg Editing /etc/proftpd.conf ... Starting professional ftp daemon: proftpd. ※ dpkg --contents で調べたパッケージ内容の一部 drwxr-xr-x root/root 0 2001-03-12 00:20:50 ./etc/ drwxr-xr-x root/root 0 2001-03-12 00:20:46 ./etc/init.d/ -rwxr-xr-x root/root 1987 2001-03-12 00:13:26 ./etc/init.d/proftpd drwxr-xr-x root/root 0 2001-03-12 00:20:51 ./etc/cron.monthly/ -rw-r--r-- root/root 369 2001-03-12 00:13:26 ./etc/cron.monthly/pro ftpd drwxr-xr-x root/root 0 2001-03-12 00:20:51 ./etc/pam.d/ -rw-r--r-- root/root 418 2001-03-12 00:13:26 ./etc/pam.d/ftp -rw-r--r-- root/root 2301 2001-03-12 00:20:51 ./etc/proftpd.conf drwxr-xr-x root/root 0 2001-03-12 00:20:51 ./usr/ drwxr-xr-x root/root 0 2001-03-12 00:21:13 ./usr/bin/ -rwxr-xr-x root/root 32024 2001-03-12 00:21:12 ./usr/bin/ftpcount -rwxr-xr-x root/root 33152 2001-03-12 00:21:13 ./usr/bin/ftpwho drwxr-xr-x root/root 0 2001-03-12 00:21:13 ./usr/sbin/ -rwxr-xr-x root/root 415664 2001-03-12 00:21:13 ./usr/sbin/proftpd -rwxr-xr-x root/root 11490 2001-03-12 00:20:51 ./usr/sbin/ftpstats -rwxr-xr-x root/root 9048 2001-03-12 00:21:13 ./usr/sbin/ftpshut drwxr-xr-x root/root 0 2001-03-12 00:20:51 ./usr/share/ drwxr-xr-x root/root 0 2001-03-12 00:20:45 ./usr/share/doc/ drwxr-xr-x root/root 0 2001-03-12 00:20:55 ./usr/share/doc/proftp ..... 2) 設定ファイルの編集 アクセス制御ファイルは /etc/proftpd.conf である. Debian パッケージで自動生成されたファイルを一部修正した. 修正箇所をリストアップする. a) ServerName の変更 デフォルトでは "Debian" となっているものを "Jspace" に変更. ServerName "Jspace" b) 参照される passwd, group ファイルの変更. anonymous ftp user からシステムの passwd, group ファイルが 見えるのはセキュリティー上問題がある. 以下の二行を追加し, システムに存在するユーザ名等を見せなくした. AuthUserFile /etc/proftpd.passwd AuthGroupFile /etc/proftpd.group --------------------- proftpd.passwd の内容 --------------------- ftp:x:101:65534::/home/ftp:/bin/false ※ /etc/passwd の ftp ユーザの内容だけを記述した. --------------------- proftpd.group の内容 --------------------- 空ファイル ※ なお上記設定ファイルのパーミッションは以下の通り. jspace$ ls -l proftpd.* -rw-r--r-- 1 root root 2501 Apr 19 17:23 proftpd.conf -rw-r--r-- 1 root root 0 Apr 19 17:39 proftpd.group -rw-r--r-- 1 root root 38 Apr 19 17:38 proftpd.passwd c) 接続待ち状態での実行権限の確認. 接続待ち状態の実行権限が root になっていないことを確認. デフォルト設定の接続待ち状態の実行権限 nobody ユーザを利用する. # Set the user and group that the server normally runs at. User nobody Group nogroup 接続された場合の権限は, ftp login した実ユーザー, あるいは anonymous の場合には ftp ユーザの権限とする(これもデフォルト値を使用) User ftp Group nogroup : : 3) wuftp での遺産を消去. $ cd ~ftp $ sudo rm -fr bin lib etc 4) 再起動 % /etc/init.d/proftpd stop % /etc/init.d/proftpd start 5) 注意 ログの在処: session 開始が /var/log/ftpd.log に記録される。 session 終了が /var/log/messages に記録される。 ftp による file 転送の記録が /var/log/xferlog に記録される。 6) 参考情報 /usr/doc/proftpd 以下にドキュメントが存在する。 http://www.infoscience.co.jp/technical/proftpd/ に日本語訳ドキュメントあり. 7) 2001/04/19 現在の /etc/proftpd.conf ----ここより------- # This is a basic ProFTPD configuration file (rename it to # 'proftpd.conf' for actual use. It establishes a single server # and a single anonymous login. It assumes that you have a user/group # "nobody" and "ftp" for normal operation and anon. ServerName "Jspace" ServerType standalone DeferWelcome off # 以下2行を追加. # anonyumous ftp user からユーザ名などを隠蔽する。 # /etc/proftpd.group は空。 # /etc/proftpd.passwd は以下の通り、ftp のみの情報を含む。 # ftp:x:100:65534::/home/ftp:/bin/false # AuthUserFile /etc/proftpd.passwd AuthGroupFile /etc/proftpd.group ShowSymlinks on MultilineRFC2228 on DefaultServer on ShowSymlinks on AllowOverwrite on TimeoutNoTransfer 600 TimeoutStalled 600 TimeoutIdle 1200 # # anonymous login の記録を取る. # ExtendedLog /var/log/ftp.log auth DisplayLogin welcome.msg DisplayFirstChdir .message LsDefaultOptions "-l" # Port 21 is the standard FTP port. Port 21 # Umask 022 is a good standard umask to prevent new files and dirs # (second parm) from being group and world writable. Umask 022 022 # To prevent DoS attacks, set the maximum number of child processes # to 30. If you need to allow more than 30 concurrent connections # at once, simply increase this value. Note that this ONLY works # in standalone mode, in inetd mode you should use an inetd server # that allows you to limit maximum number of processes per service # (such as xinetd) MaxInstances 30 # Set the user and group that the server normally runs at. User nobody Group nogroup # Normally, we want files to be overwriteable. AllowOverwrite on # A basic anonymous configuration, no upload directories. User ftp Group nogroup # We want clients to be able to login with "anonymous" as well as "ftp" UserAlias anonymous ftp RequireValidShell off # Limit the maximum number of anonymous logins MaxClients 10 # We want 'welcome.msg' displayed at login, and '.message' displayed # in each newly chdired directory. DisplayLogin welcome.msg DisplayFirstChdir .message # Limit WRITE everywhere in the anonymous chroot DenyAll # Uncomment this if you're brave. # # # DenyAll # # # AllowAll # # ----ここまで-------