***********************************************************************

FTPサーバ(Green) ProFTPD インストール & 設定

2002/10/09 槌谷翼 作成 ***********************************************************************

□Introduction

FTPとはFile Transfer Protocol(ファイル転送プロトコル)の略である。 つまり、 ネットワークを経由してファイルをやり取りするための 仕組みのことである。これはサーバからファイルをダウンロード、あるいは アップロードするときによく用いられる。 ここでは Proftpd-1.2.0pre10.tar.gz を用いてFTPサーバを構築する方法を 解説する。 なお、OS(オペレーティングシステム)のインストールについては再構築資料 "基本システムのインストール"を参照し、終えておくこと。

□ProFTPD の入手

・ 以下の場所より proftpd-1.2.0pre10.tar.gz を入手 ftp://ftp.infoscience.co.jp/pub/proftpd/proftpd-1.2.0pre10.tar.gz ・ proftpd-1.2.0pre10.tar.gz を /usr/local/src/ にて展開. $ cd /usr/local/src/ $ tar -zxvf proftpd-1.2.0pre10.tar.gz

□ProFTPD のコンパイルとインストール

・ proftpd-1.2.0pre10.tar.gz を /usr/local/src/ にて展開後, proftpd-1.2.0pre10 のディレクトリに移動. $ cd proftpd-1.2.0pre10 ・ルートユーザーの属するグループ名称の確認 ルートのユーザー名をroot, グループ名をroot(つまりデフォルト) とする. ・configureを実行 $ sudo ./configure ※ここで, ライブラリイが足りなくて configure の実行ができなかった. したがって libc6-dev のインストール. $ sudo apt-get install libc6-dev 以下 root になって実行 $ sudo -s ・makeの実行 # make ・続いて make install の実行 # make install

□環境設定

運用条件は以下の通りとする. *************************************************** ・standalone でサーバを立ち上げる(standaloneモード) ・普通ユーザーでのログインはデフォルトのまま ・anonymous のログインを許可する ・anonymous でログインしたユーザーは書き込み禁止 ・incoming ディレクトリには put だけができる (getはできない) ・anonymous での同時ログインは最大10まで *************************************************** ○ユーザー ftp の作成 *********************************************************** ・ftpユーザーの属すグループ名をftpとする. ・ユーザーftpのユーザーIDを14番, グループIDを10000番とする. ・ユーザーftpのホーム・ディレクトリを/home/ftp/ ・anonymous 用のディレクトリとして/home/ftp/pub/ と /home/ftp/incoming/ を作成. *********************************************************** /etc/group ファイルを以下のように書き換える. ftp:x:10000: /etc/passwd ファイルを以下のように書き換える. ftp:x:14:10000:anonymous:/home/ftp:/bin/false ※ passwd ファイルの最後のフィールドは 正しいシェルを指定していない状態にすること. ここでは /bin/false としている. ftpユーザーのディレクトリのパーミッションを 755 とする. # chmod -R 755 ftp/ ○proftpd.confの編集 (雛型としてproftpd_orignal.conf をとる) # vi /usr/local/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 "ProFTPD Default Installation" ServerType standalone DefaultServer on # Port 21 is the standard FTP port. Port 21 # Umask 022 is a good standard umask to prevent new dirs and files # from being group and world writable. Umask 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 ftp # 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 DenyAll AllowAll =============================================================================== ○動作確認 pub/ 下に test.txt をおく. ftpサーバの起動をする. $ sudo /usr/local/sbin/proftpd ※ まえのプロセスがある場合はこれを kill する. $ ps aux |less $ sudo kill [プロセス番号] 自分自身にたいして $ ftp localhost コンフィギュレーションファイルに誤りがなければ, $ ftp localhost Connected to localhost. 220 ProFTPD 1.2.0pre10 Server (ProFTPD Default Installation) [green.ep.sci.hokudai.ac.jp] Name (localhost:mondo15): となる. 続いて anonymous FTP接続の確認. Name (localhost:mondo15): anonymous 331 Anonymous login ok, send your complete e-mail address as password. Password: 230 Anonymous access granted, restrictions apply. Remote system type is UNIX. Using binary mode to transfer files. ftp> となったら完了。 ------------------------------------------------------------------------------- 最終更新日2002.10.09 槌谷 翼