サーバーへの道

のんびりとサーバ構築する様子を日記にしてます。目的はLinuxの勉強、目標はサーバ運用です。きっと脱線します。

vsftpdの設定

2009-03-17 03:19:29 | Weblog
なんとなく使えてきたというレベルですけど、
vsftpdの設定方法です。

centOS 5.2だとvsftpdは /etc/vsftpd/にvsftpd.confファイルが
格納されているはずです。
それの中を見てみましょう。

雰囲気だけでこんな設定ですよぅ。と
説明書きしています。。

英語が読める人はそっちの方が性格ですね



======================vsftpd.conf=======================
# Example config file /etc/vsftpd/vsftpd.conf
#
# The default compiled in settings are fairly paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
# Please see vsftpd.conf.5 for all compiled in defaults.
#
# READ THIS: This example file is NOT an exhaustive list of vsftpd options.
# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's
# capabilities.
#
# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
# anonymous(匿名)ユーザの許可YES/拒否NO
anonymous_enable=NO
#
# Uncomment this to allow local users to log in.
# local users(ローカルユーザ)の許可YES/拒否NO
local_enable=YES
#
# Uncomment this to enable any form of FTP write command.
# FTPユーザ(FTPログイン者の)FTPコマンドの許可YES/拒否NO
# (STOR, DELE, RNFR, RNTO, MKD, RMD, APPE, SITE)
write_enable=YES
#
# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
# FTPユーザ(FTPログイン者の)UPロード時のデフォルトパーミッション設定
# 022はパーミッションが755 077はパーミッションが700
local_umask=022
#
# Uncomment this to allow the anonymous FTP user to upload files. This only
# has an effect if the above global write enable is activated. Also, you will
# obviously need to create a directory writable by the FTP user.
# anonymous(匿名)ユーザのアップロードの許可(YES)/拒否(NO)
#anon_upload_enable=YES
#
# Uncomment this if you want the anonymous FTP user to be able to create
# new directories.
# anonymous(匿名)ユーザのフォルダ作成の許可(YES)/拒否(NO)
#anon_mkdir_write_enable=YES
#
# Activate directory messages - messages given to remote users when they
# go into a certain directory.
# FTPユーザ(FTPログイン者の)が初めてフォルダに移動したログを残すYES/残さないNO
dirmessage_enable=YES
#
# Activate logging of uploads/downloads.
# FTPユーザ(FTPログイン者の)のUP/DOWNのログを残すYES/残さないNO
xferlog_enable=YES
#
# Make sure PORT transfer connections originate from port 20 (ftp-data).
# FTPの接続するポート20を使用するYES/しないNO
# この接続で行うとREDHatでは制限がかかるそうで
# pasvモード接続時はpasvモードの設定が有効となる。
connect_from_port_20=YES

# pasvモード接続の使用許可YES/拒否NO
pasv_enable=YES

# pasv_addres(ルータのWAN側のIPアドレス)で固定IPを設定するが特に設定する必要はない
# 調べてから設定しましょう。
# pasv_address=kctweb.dip.jp

# pasv_promiscuousこの設定はデータチェック(同IPアドレスなのか?)を行わなくなります(YES)
# このオプションは絶対に必要な時以外は、有効にしないで下さい。
# 有効にすると、データ転送を開始する制御接続と同一の
# IP アドレスからでてくるパッシブモード接続を確証する重要なセキュリティ機能を
# 解除してしまいます
pasv_promiscuous=NO
#
#pasvモードの使用ポート範囲設定です。
pasv_min_port=50000
pasv_max_port=50005
#
#ローカルユーザーがログインした後に
#vsftpdが移動するディレクトリを指定します
# local_root=/public_html/user
#
# If you want, you can arrange for uploaded anonymous files to be owned by
# a different user. Note! Using "root" for uploaded files is not
# recommended!
# anonymous(匿名)ユーザによってアップロードされた時の
# ファイル所有権を指定(指定するYES/指定しないNO)
#chown_uploads=NO
# 指定した場合所有権の名前(root等)
#chown_username=whoever
#
# You may override where the log file goes if you like. The default is shown
# below.
# xferlog_enable/xferlog_std_format/dual_log_enableのYESの時のログ出力先
xferlog_file=/var/log/vsftpd.log
#
# If you want, you can have your log file in standard ftpd xferlog format
xferlog_std_format=NO
#
# You may change the default value for timing out an idle session.
# FTP接続されている時に何もしていないと切断する時間の設定
idle_session_timeout=600
#
# You may change the default value for timing out a data connection.
# データ転送中に停止してしまった時の何もしてないと切断する時間の設定
data_connection_timeout=120
#
# It is recommended that you define on your system a unique user which the
# ftp server can use as a totally isolated and unprivileged user.
# 非特権ユーザの場合の特権設定?(使わなくてもいいかも?)
#nopriv_user=ftpsecure
#
# Enable this and the server will recognise asynchronous ABOR requests. Not
# recommended for security (the code is non-trivial). Not enabling it,
# however, may confuse older FTP clients.
#async ABOR"コマンドを有効にする
#async_abor_enable=YES
#
# By default the server will pretend to allow ASCII mode but in fact ignore
# the request. Turn on the below options to have the server actually do ASCII
# mangling on files when in ASCII mode.
# Beware that on some FTP servers, ASCII support allows a denial of service
# attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd
# predicted this attack and has always been safe, reporting the size of the
# raw file.
# ASCII mangling is a horrible feature of the protocol.
# ASCIIモードのアップロードダウンロードを許可YES/拒否(NO)する
ascii_upload_enable=YES
ascii_download_enable=YES
#
# You may fully customise the login banner string:
#サーバに接続したとき(ユーザ名を入力する前)に表示されるテキストを含むファイル名を指定する
ftpd_banner=Welcome to blah FTP service.
#
# You may specify a file of disallowed anonymous e-mail addresses. Apparently
# useful for combatting certain DoS attacks.
#deny_email_enable=YES
# (default follows)
#banned_email_file=/etc/vsftpd/banned_emails
#
# You may specify an explicit list of local users to chroot() to their home
# directory. If chroot_local_user is YES, then this list becomes a list of
# users to NOT chroot().
# FTPユーザ(FTPログイン者)が設定されているデフォルトルートより上に行ける・行けないの設定
chroot_list_enable=YES
#chroot_local_user=YES
# (default follows)
# chroot_list_enableでのFTPユーザリスト
chroot_list_file=/etc/vsftpd/chroot_list
#
# You may activate the "-R" option to the builtin ls. This is disabled by
# default to avoid remote users being able to cause excessive I/O on large
# sites. However, some broken FTP clients such as "ncftp" and "mirror" assume
# the presence of the "-R" option, so there is a strong case for enabling it.
#フォルダ単位での操作の許可YES/拒否NO
ls_recurse_enable=YES
#
# When "listen" directive is enabled, vsftpd runs in standalone mode and
# listens on IPv4 sockets. This directive cannot be used in conjunction
# with the listen_ipv6 directive.
listen=YES
#listen_port=21
#
# This directive enables listening on IPv6 sockets. To listen on IPv4 and IPv6
# sockets, you must run two copies of vsftpd whith two configuration files.
# Make sure, that one of the listen options is commented !!
#listen_ipv6=YES

#pam_service_name=vsftpd
#FTPユーザログイン設定
userlist_enable=YES
userlist_deny=NO

#FTPユーザログインリストファイルの場所指定
userlist_file=/etc/vsftpd/user_list
#FTPユーザ設定法
#FTPユーザ名がファイル名になりその中に設定ができる
#ちなみにユーザ登録はLinux端末でコマンドの
#コマンド:useradd [username]
#コマンド:passwd [username]
#※passwdユーザー指定後にpasswordの入力
# 例)hoge1というユーザでパスワードをhogeとする。(passwordは4文字以上必要)
# >useradd hoge1
# >passwd hoge1
#New UNIX password:    ←ここでhogeと入力してエンター
#Retype new UNIX password: ←確認。
#passwd: all authentication tokens updated successfully. ←メッセージが出る。


#FTPユーザ毎の設定ファイル先(ディレクトリ)
user_config_dir=/etc/vsftpd/userconf

#今は良くわかってませんがこれで動きます。
tcp_wrappers=YES
#ssl_enable=YES
#rsa_cert_file=/etc/pki/tls/certs/vsftpd.pem
#force_local_logins_ssl=NO
#force_local_data_ssl=NO
=============================================================


あとは
=====コマンド=============
mkdir /etc/vsftpd/userconf
mkdir /home/hoge1
chmod /hoge/hoge1
echo hoge1 >> /etc/vsftpd/user_list
echo hoge1 >> /etc/vsftpd/chroot_list
echo local_root=/home/hoge1 >> /etc/vsftpd/userconf/hoge1

useradd hoge1
passwd hoge1
[New UNIX password:]hoge
[Retype new UNIX password:]hoge
=====コマンド=============

指定した/home/hoge1より上のフォルダは移動不可での
FTPユーザが完成しましたとさw

ちなみにvsftpd.confファイルの中身は設定まるまる
コピーしちゃっても動くのではないかな?と
思っています。

自分の環境では動作しますが
他人の環境では動作未確認ですw

いじる前にvsftpd.confファイルのbackupファイルを
作成しておきましょう

1ヶ月くらいブログの事忘れてました。

2009-03-16 13:09:57 | Weblog
誰も見てないと思うけど、
お久しぶりに更新です。

どうもこういうの毎日欠かさずやる・・・って
難しいようです

でもでも、思い出した時にはちゃんと更新かけておくので
すぐに諦める事はしません

サーバ構築も少しずつ着実に進めています。
サーバ構築の当初の予定の「webサーバ」は完成まで目前。


apacheの設定をユーザ毎に切り分け出来るようになれば
一先ず稼動可能な環境になります

改めて
os:centOS 5.2
必要なソフト
apache/vsftpd

vsftpdはユーザ毎にアクセス出来るようになったので
とりあえずFTPサーバは可能。

apacheは・・・・出来そうでまだやってない感じ(笑)


でもそろそろ動くので誰かにテストユーザになってもらいたいなぁと、
思っている所ですがHDDの使用容量の制限のかけ方がまだわからんから
追々その方法を勉強するって事で。。。

テストユーザの条件は

(1)まだ稼動前なので不定にサーバが落ちる事があります(だめジャン)

(2)バックアップもとらず、予告なしに再インストールする可能性大(自分勝手すぎ)
 ※さすがに予告はするかも・・・

(3)マナー重視できる人


(4)著作権保護を侵さない

(5)誹謗中傷はもってのほか

(6)管理者の独断と偏見で信頼できる人

※協力者が必要です。。。

ひじょーに勝手なことばかり書いているのは重々承知のうえなんですが、
ここらへんが守れる人にサーバ領域の提供したいなぁと
思っています。。。

このブログをみてくれている人・・・・限定もあるのねw