FTP Server (vsftpd)
概要
vsftpd (Very Secure FTP Daemon) を使用した FTP サーバーを提供します。 これにより、ユーザーは WordPress のファイルシステム (/var/www/html) に直接アクセスし、テーマファイルやプラグインのアップロード・編集を行うことができます。
構成
Dockerfile 解析 (srcs/requirements/bonus/ftp/Dockerfile)
dockerfile
FROM debian:bullseye
RUN apt-get update && apt-get install -y \
vsftpd \
&& rm -rf /var/lib/apt/lists/*
COPY conf/vsftpd.conf /etc/vsftpd.conf
# chroot 用ディレクトリの作成 (Secure Chroot)
RUN mkdir -p /var/run/vsftpd/empty
COPY tools/entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh
# 制御ポート(21) と パッシブモード用データポート範囲
EXPOSE 21 21100-21110
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
CMD ["/usr/sbin/vsftpd", "/etc/vsftpd.conf"]セキュリティ機能
- ユーザー分離: 専用ユーザー (
FTP_USER) を使用し、WordPressのボリューム権限を適切に管理します。 - Chroot Jail: ユーザーはホームディレクトリ (
/var/www/html) より上位の階層にはアクセスできません。
ユーザー管理
entrypoint.sh にて、環境変数 (FTP_USER, FTP_PASSWORD) に基づいてユーザーを作成します。このユーザーは WordPress コンテナとボリュームを共有しているため、ファイルの所有権問題を防ぐために UID/GID の調整が必要となる場合があります(通常 www-data と合わせる等)。
接続方法
FTP クライアント (FileZilla など) を使用して接続します。
- Host:
localhost(Port Forwarding時) or Domain - Port:
21 - Protocol: FTP - File Transfer Protocol (Plain)
- Encryption: Only use plain FTP (insecure)
- Passive Mode: 有効化必須