今日は、まず、FTPD の設定から。
CentOS 7 のインストール時に、選択した環境のアドオンの一覧から
FTP サーバーにチェックを入れたので、Vsftpd はインストール済みです。
# yum list installed | grep vsftpd
vsftpd.x86_64 3.0.2-27.el7 @anaconda
vsftpd を起動して
# systemctl start vsftpd
自動起動設定をします。
# systemctl enable vsftpd
Created symlink from /etc/systemd/system/multi-user.target.wants/vsftpd.service to /usr/lib/systemd/system/vsftpd.service.
続いて、vsftpd.conf 変更して、vsftpd を設定します。
# cd /etc/vsftpd/
# cp -p vsftpd.conf vsftpd.conf.org
# vi vsftpd.conf
作業ディレクトリを移動して既存のファイルをバックアップし、
vsftpd.conf の編集を開始します。
アノニマスFTPの無効化
anonymous_enable=YES
↓↓↓
anonymous_enable=NO
asciiアップロード、ダウンロードの有効化
#ascii_upload_enable=YES
#ascii_download_enable=YES
↓↓↓
ascii_upload_enable=YES
ascii_download_enable=YES
ls有効化設定(ディレクトリごと一括での転送機能を有効化)
#ls_recurse_enable=YES
↓↓↓
ls_recurse_enable=YES
IPv4 のみをリスンする
listen=NO
↓↓↓
listen=YES
listen_ipv6=YES
↓↓↓
listen_ipv6=NO
vsftpd.conf の最後に以下の設定を追記します。
パッシブポートの設定
# other settings
pasv_min_port=60001
pasv_max_port=60010
usr_localtime設定
use_localtime=YES
隠しファイル表示
force_dot_files
最後に Firewall の FTP接続ポートのオープン
(パッシブ接続用ポートの許可)
# firewall-cmd –add-port=60001-60010/tcp –zone=manage –permanent
確認します。
# firewall-cmd –list-all –zone=manage
manage (active)
target: ACCEPT
icmp-block-inversion: no
interfaces:
sources: 192.168.1.0/24
services: ftp ssh
ports:
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
あれっ?
ports: 60001-60010/tcp
って、なってない。
とりあえず、接続してみよう……
あれっ?
# systemctl status vsftpd
● vsftpd.service – Vsftpd ftp daemon
Loaded: loaded (/usr/lib/systemd/system/vsftpd.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since 土 2020-07-11 19:47:14 JST; 9s ago
Process: 21061 ExecStart=/usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf (code=exited, status=2)
Main PID: 20641 (code=killed, signal=TERM)
7月 11 19:47:14 CentOS-7-99Server systemd[1]: Starting Vsftpd ftp daemon…
7月 11 19:47:14 CentOS-7-99Server vsftpd[21061]: 500 OOPS: missing value in…
7月 11 19:47:14 CentOS-7-99Server systemd[1]: vsftpd.service: control proc…2
7月 11 19:47:14 CentOS-7-99Server systemd[1]: Failed to start Vsftpd ftp d….
7月 11 19:47:14 CentOS-7-99Server systemd[1]: Unit vsftpd.service entered ….
7月 11 19:47:14 CentOS-7-99Server systemd[1]: vsftpd.service failed.
Hint: Some lines were ellipsized, use -l to show in full.
あれれれっ?
お。
# firewall-cmd –reload
success
をしてなかった。
おおお。
vsftpd.conf
に、pasv_enable=YES の行を追加するのを忘れてた。
パッシブポートの設定
# other settings
pasv_min_port=60001
pasv_max_port=60010
↓↓↓
パッシブポートの設定
# other settings
pasv_enable=YES
pasv_min_port=60001
pasv_max_port=60010
でも、ダメだ……
おやっ?
# systemctl start vsftpd
Job for vsftpd.service failed because the control process exited with error code. See "systemctl status vsftpd.service" and "journalctl -xe" for details.
最初に起動させた時にエラーでてた……orz
# /usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf
500 OOPS: missing value in config file for: force_dot_files
↑↑↑んな便利な文法に問題がないかをチェックする機能が
あったのね!早く言ってよ!
# force_dot_files
コメントアウトして、
# systemctl status vsftpd
● vsftpd.service – Vsftpd ftp daemon
Loaded: loaded (/usr/lib/systemd/system/vsftpd.service; enabled; vendor preset: disabled)
Active: active (running) since 土 2020-07-11 23:34:46 JST; 10min ago
Process: 1467 ExecStart=/usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf (code=exited, status=0/SUCCESS)
Main PID: 1468 (vsftpd)
CGroup: /system.slice/vsftpd.service
mq1468 /usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf
7月 11 23:34:46 CentOS-7-99Server systemd[1]: Starting Vsftpd ftp daemon…
7月 11 23:34:46 CentOS-7-99Server systemd[1]: Started Vsftpd ftp daemon.
解決!
# force_dot_files
↓↓↓
force_dot_files=YES
YES が抜けてるじゃん!