WORKSTATION     SERVER     NETWORK     WINDOWS     LINUX

 

HOME

 

Server Build

 Sever Machine

 Fedora Core2

 Fedora Core3

 Apache2

 VSFTP

 SSHD

 Samba

 MySQL

 PHP5

 Apache+WebDAV

 Apache+SSL

 

PC Support

 Spy・Add Ware

 

 

VIC'S FACTORY

vic@red-diamonds.net

 

VSFTPDの設定

 

FTPの使用用途はサーバーで使用するツールやデータの転送とHP用のファイルの転送に限定しますので、「匿名ログインは許可しない」「VSFTPへの接続はTCPラッパーを使用してIPアドレスで制限する」ことを前提として設定します。
 

1. 条件設定

「vsftpd.conf」を下記の通り修正します。

# vi /etc/vsftpd/vsftpd.conf

 

・anonymousログインを禁止
  aonymous_enable=YES  NO

 

・アスキーモード許可
  # ascii_upload_enable=YES   # OFF
  # ascii_download_enable=YES  同上

 

・セキュリティ向上のためメッセージバナーを設定
  #
ftpd_banner=Welcome to blah FTP service.

              ↓

  ftpd_banner=Unknown.  # OFF and メッセージ書き換え

 

・指定ユーザー以外はホームディレクトリからの移動を禁止
  # chroot_list_enable=YES   # OFF
  chroot_local_user=YES   1行追加
  # chroot_list_file=/etc/vsftpd.chroot_list  # OFF

 

・指定ユーザーのみログイン許可
  userlist_enable=YES   この行の下に
  userlist_deny=NO    この1行を追加

 

・一括してフォルダとディレクトリを削除できるように設定
  #
ls_recurse_enable=YES → # OFF

 

・アップロードの時間を日本時間にする
  use_localtime=YES   この1行を追加

 

・PASVモード有効化

  pasv_promiscuous=YES   この1行を追加

 

・ユーザディレクトリの設定 ※必要な場合のみ

 (ホームディレクトリをユーザディレクトリの「html」フォルダにする)
  local_root=html   この1行を追加

 

・最終行の"tcp_wrapper=YES"を確認

 


2. ログインを許可するユーザーを登録します。

「vsftpd.user_list」を編集します。このリストに、ログインを許可するユーザー名だけを「#」無しで記入します。例:ユーザ「vic」だけを許可

# vi /etc/vsftpd.user_list

# vsftpd userlist
# If userlist_deny=NO, only allow users in this file
# If userlist_deny=YES (default), never allow users in this file, and
# do not even prompt for a password.
# Note that the default vsftpd pam config also checks /etc/vsftpd.ftpusers
# for users that are denied.

#root
#bin
#daemon
#adm
#lp
#sync
#shutdown
#halt
#mail
#news
#uucp
#operator
#games
vic

 

3. ログインを拒否するユーザーを登録します。

「vsftpd.ftpusers」を編集します。このリストに記載されたユーザはVSFTPDにログインできません。

例:拒否ユーザに「vic」を追加

# vi /etc/vsftpd.ftpusers

# vsftpd userlist
# Users that are not allowed to login via ftp
root
bin
daemon
adm
lp
sync
shutdown
halt
mail
news
uucp
operator
games
nobody
vic


4. ホームディレクトリから移動できるユーザーを登録します。
「vsftpd.chroot_list」を新規作成し、/etc/ディレクトリに保存します。

例:ユーザ「vic」を移動許可

# vi /etc/vsftpd.chroot_list

vic

 

5. TCPラッパーの設定

VAFTPDに接続出来るユーザーをIPアドレス単位で指定する場合、TCPラッパーの設定
をします。

「hosts.deny」を編集し、全ホストからのVSFTPDへのアクセスを拒否します。

# vi /etc/hosts.deny

# hosts.deny  This file describes the names of the hosts which are
#             *not* allowed to use the local INET services, as decided
#             by the '/usr/sbin/tcpd' server.
#
# The portmap line is redundant, but it is left to remind you that
# the new secure portmap uses hosts.deny and hosts.allow. In particular
# you should know that NFS uses portmap!

vsftpd : all      ←  この1行を追加

 

「hosts.allow」を編集し、許可するIPアドレスを指定します。(複数指定可)

# vi /etc/hosts.allow

#
# hosts.allow This file describes the names of the hosts which are
# allowed to use the local INET services, as decided
# by the '/usr/sbin/tcpd' server.
#

vsftpd : 許可するIPアドレス      ←  この1行を追加

 

6. vsftpdの起動と終了。

起動

# /etc/init.d/vsftpd start
 

終了

# /etc/init.d/vsftpd stop