VineLinuxパフォーマンスアッププロジェクト:0024
■proftpd.confの設定方法と見方■
ftpサーバを立ち上げる際に、VineLinuxにはProftpdというftpパッケージがあります。今回はその設定方法から立ち上げまで手順を紹介します。
まず、Proftpdパッケージをインストールします(インストールされていない場合のみ)。
rpm -ivh proftpd-XXXX.i386.rpm(←XXXXはバージョン番号など)
インストール完了後、さっそくroot権限で設定ファイルを開きます。場所は/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 "XXXXXX" <-------------(1)
ServerType standalone
DefaultServer on
UseReverseDNS off -+
IdentLookups off -+<-------------(2)
# 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
# Use localtime
TimesGMT FALSE
# 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 under which the server will run.
User nobody
Group nobody
# Normally, we want files to be overwriteable.
<Directory />
AllowOverwrite on <-------------(3)
</Directory>
# A basic anonymous configuration, no upload directories.
#<Anonymous ~ftp>
# User ftp
# Group ftp
# We want clients to be able to login with "anonymous" as well as "ftp"
# UserAlias anonymous ftp
# Limit the maximum number of anonymous logins
# MaxClients 10
# do not require shells listed in /etc/shells (user ftp do not have
# shell...)
# RequireValidShell no
# 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
# <Limit WRITE>
# DenyAll
# </Limit>
#</Anonymous>
ファイル中に示した番号に沿ってその意味を説明します。
(1):ServerName "XXXXXX"
これはftpでログインしたときに表示されるサーバの名称を記述する部分です。特に重要ではないのでXXXXXX部分に分かりやすい名前(例えばMy Ftp Serverなど)をつけておくといいでしょう。
(2):UseReverseDNS off
IdentLookups off
デフォルトでこの記述はないはずですが、この2行を記述しておけばDNSを用いた名前解決の時間を短縮して高速に接続できるようになります。
(3):AllowOverwrite on
これはファイルの上書きを許可する記述です。頻繁に更新するファイルもあるので、これは必ずonにしておきましょう。
★Anonymous ftpについて
Anonymous ftp(匿名ftp)はセキュリティ上好ましくありません。たとえ多数のユーザが1つのサーバを利用するにしてもサーバ側でユーザを1人1人つくり、パスワード認証を行うほうが安全です。
したがって、設定ファイルの< Anonymous >〜< /Anonymous >までをコメント行("#"をつける)にしておきましょう。
Anonymous ftpとは(Yahoo!コンピュータより)
インターネット上に多数存在する公共のソフトウェアやデータを不特定多数に配布するために考案されたシステム。通常はアカウントとパスワードによって保護されるFTPサイトを、アカウント名にanonymous(「匿名」という意味)と入力することにより誰でも利用できるようにしたもの。
ログインする際に自分のメールアドレスをパスワードとして入力する慣行がある。
あとは設定ファイルを保存し、proftpdデーモンを起動します。
/etc/rc.d/init.d/proftpd start
proftpdを電源投入時から常時起動させるようにしておくにはroot権限で以下のように実行します。
/sbin/chkconfig proftpd on
これでftpサーバができあがりました。あとはftpコマンドを用いた接続テストとログインテスト、そしてputコマンドを用いた転送テストを行って異常がなければOKです。