FTPの環境構築方法を調べた。
■インストール
インストールされているか確認。
1 2 |
[root@localhost ~]# rpm -qa | grep vsftpd vsftpd-2.2.2-14.el6.x86_64 |
何も出力されない場合はインストールが必要。
1 |
[root@localhost ~]# yum install -y vsftpd |
起動。※起動失敗する場合は、起動済みの可能性あり。
1 2 |
[root@localhost ~]# service vsftpd start vsftpd 用の vsftpd を起動中: [ OK ] |
■ 設定ファイル
設定ファイルを修正。
1 |
[root@localhost ~]# vi /etc/vsftpd/vsftpd.conf |
文末に以下を追加。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
#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. 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 # # This directive enables listening on IPv6 sockets. To listen on IPv4 and IPv6 # sockets, you must run two copies of vsftpd with two configuration files. # Make sure, that one of the listen options is commented !! #listen_ipv6=YES pam_service_name=vsftpd userlist_enable=YES userlist_deny=NO userlist_file=/etc/vsftpd/user_list tcp_wrappers=YES |
FTPを許可するユーザー一覧(FTPアクセスする許可ユーザーを登録する)
1 |
[root@localhost ~]# vi /etc/vsftpd/user_list |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# 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 nobody [FTP許可ユーザー] |
FTPを許可しないユーザー一覧(FTPアクセスする許可しないユーザーを登録する)
1 |
[root@localhost ~]# vi /etc/vsftpd/ftpusers |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
# Users that are not allowed to login via ftp root bin daemon adm lp sync shutdown halt mail news uucp operator games nobody |
設定は終了。
■ Windowsなどからアクセス。
FFFTPツールを使用してのアクセスしてみる。アクセスできれば成功。
※もしつながらない場合は、ファイアーウォール、SELinuxあたりの設定が必要かも。。。
細かいFTPコマンドについては次回☆☆☆
終了。