← 記事一覧へ

ProFTPD バーチャルユーザーの追加

概要

ProFTPDでバーチャルユーザーを設定する機会があったため、備忘録としてまとめる。 バーチャルユーザーの追加方法にはデータベースを使用する方法もあるが、今回はftpasswdを使用して追加する。

バーチャルユーザーとは?

Linux システムの通常のユーザー(システムユーザー)とは別に、FTP サーバー専用のユーザーとして管理されるユーザーを指す。

前提条件

  • OS: Amazon Linux 2
  • proftpdはインストール済み

パッケージのインストール

ftpasswdコマンドが使用できなかったのでパッケージをインストールする。

yum install -y proftpd-utils

バーチャルユーザーを追加

認証ファイルは自動作成される。

ftpasswd --passwd --file=/etc/ftpd.passwd --name test-user --uid=1 --gid=1 --home=/var/www --shell=/sbin/false

グループの作成

ftpasswd --group --file="/etc/ftpd.group" --name test-user-group --gid=1 --member=test-user

権限の修正

chmod 600 /etc/ftpd.passwd
chmod 600 /etc/ftpd.group

設定ファイルの修正

上記で追加した認証ファイルを読み込むようにする。

vi /etc/proftpd.conf

---
AuthPAMConfig proftpd
// 以下にmod_auth_file.cを追加
AuthOrder mod_auth_file.c mod_auth_unix.c
//ここに以下を追加
AuthUserFile /etc/ftpd.passwd
AuthGroupFile /etc/ftpd.group
---

再起動

設定を反映させるため再起動する。

systemctl restart proftpd.service

これでバーチャルユーザーを追加することができたので、FTPクライアントでログイン確認をして完了。

参考

http://www.proftpd.org/docs/howto/VirtualUsers.html