vsftpdの基本設定
vsftpdでFTPサーバを動作させたのでメモ。
# vsftpd -v vsftpd: version 2.0.5
基本設定は/etc/vsftpd/vsftpd.confで行う。以下主要な部分だけを抜粋。後日追加するかもしれん。
# cat vsftpd.conf # Example config file /etc/vsftpd/vsftpd.conf # # Allow anonymous FTP? (Beware - allowed by default if you comment this out). # 匿名ログインを許可しない anonymous_enable=NO # # Uncomment this to allow local users to log in. # ローカルユーザーのログインを許可する local_enable=YES # # Uncomment this to enable any form of FTP write command. # FTPの書き込みコマンドを許可する 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) # デフォルトのumaskを022とする local_umask=022 # /etc/vsftpd/user_listを有効にする userlist_enable=YES # /etc/vsftpd/user_listをホワイトリストとして動作させる userlist_deny=NO # 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(). # 以下の3つの設定で、chroot_list_fileに書かれているユーザーはlocal_rootより上のディレクトリに移動できないようになる。 chroot_list_enable=YES # (default follows) chroot_list_file=/etc/vsftpd/user_list # local_root=/var/www
vsftpd: version 2.0.5には/etc/vsftpd/ftpusersというファイルがあり、ここに書かれているユーザーはftpログインできない。つまりuser_listに名前がある、かつftpusersに名前がないユーザーのみ、/var/www以下のディレクトリにftpログインできる。
なんでこんな仕様になっているかは分からないが、デフォルトではシステムアカウントがuser_listとftpusers両方に記載されており、自分のログイン用アカウントのみuser_listに記載されていた。つまり何も設定しなくても
service start vsftpd
と打てば自分のアカウントでftpログインできる。
もちろんこれは危険なので
ftpログイン専用のアカウントを作成する。
usreadd user01_www passwd user01_www usermod -s /sbin/nologin user01_www
useradd -s /sbin/nologinとすれば、システムへのログインを禁止できる。
んで、user_listから自分のログインアカウントを削除し、user01_wwwを追記すればOK。