vsftpdをインストール
[bash] [root@localhost ~]# yum -y install vsftpd [/bash]
インストールされたバージョンを確認。 [bash] [root@localhost ~]# vsftpd -v vsftpd: version 3.0.2 [/bash]
vsftpdの設定ファイルの編集
対象ファイル /etc/vsftpd/vsftpd.conf
匿名ユーザーのログインを禁止
変更前 [bash] anonymous_enable=YES [/bash] 変更後 [bash] anonymous_enable=NO [/bash]
ログファイルの設定
変更前 [bash]
xferlog_file=/var/log/xferlog
[/bash] 変更後 [bash] xferlog_file=/var/log/xferlog [/bash]
アスキーモードでのアップロード、ダウンロードを許可
変更前 [bash]
ascii_upload_enable=YES
ascii_download_enable=YES
[/bash] 変更後 [bash] ascii_upload_enable=YES ascii_download_enable=YES [/bash]
ホームディレクトリより上階層へのアクセス
・デフォルトでのアクセスを禁止 ・アクセスを許可するユーザーリストの有効化 ・アクセスを許可するユーザーのリスト名 変更前 [bash]
chroot_local_user=YES
chroot_list_enable=YES
(default follows)
chroot_list_file=/etc/vsftpd/chroot_list
[/bash] 変更後 [bash] chroot_local_user=YES chroot_list_enable=YES
(default follows)
chroot_list_file=/etc/vsftpd/chroot_list [/bash]
ディレクトリごとの削除を可能に
変更前 [bash]
ls_recurse_enable=YES
[/bash] 変更後 [bash] ls_recurse_enable=YES [/bash]
IPv4をリッスンする
変更前 [bash] listen=NO [/bash] 変更後 [bash] listen=YES [/bash]
IPv6をリッスンしない
変更前 [bash] listen_ipv6=YES [/bash] 変更後 [bash] listen_ipv6=NO [/bash]
PASVモード関連の設定
以下をすべて追記。
接続先IPアドレスをホスト名から取得
[bash] pasv_addr_resolve=YES [/bash]
接続先IPアドレスが牽けるホスト名
[bash] pasv_address=ftp.localhost [/bash]
最小ポート番号
[bash] pasv_min_port=4000 [/bash]
最大ポート番号
[bash] pasv_max_port=4005 [/bash]
タイムスタンプを日本時間
以下を追記。 [bash] use_localtime=YES [/bash]
vsftpdを起動
[bash] [root@localhost vsftpd]# systemctl start vsftpd [/bash]
vsftpdを自動起動させる
※自動起動させる場合 [bash] [root@localhost vsftpd]# systemctl enable vsftpd.service [/bash]
ポートの開放
[bash] [root@localhost vsftpd]# firewall-cmd --add-service=ftp success [root@localhost vsftpd]# firewall-cmd --add-service=ftp --permanent success [root@localhost vsftpd]# firewall-cmd --list-services dhcpv6-client ssh ftp [root@localhost vsftpd]# firewall-cmd --add-port=4000-4005/tcp success [root@localhost vsftpd]# firewall-cmd --add-port=4000-4005/tcp --permanent success [root@localhost ~]# firewall-cmd --reload success [root@localhost vsftpd]# firewall-cmd --list-ports 4000-4005/tcp [/bash]
FTPクライアントから接続
※FileZillaの場合。