0
0

vsftpd で chroot する

Last updated at Posted at 2020-07-04

私のメインの作業記録はzennに移しています。
こちらの記事はもう更新されませんので、下記のzennの記事を参照して下さい。関連する記事もリンクされません。


⚠注意❗

以下の内容は更新されておらず、古く、間違っている、仕様が変わっている、箇所があるかもしれません。正しい情報は、上記のzennの記事をご覧ください。

chroot とは

許可されたディレクトリー以下しか閲覧できなくする機能です。
FTP接続時に、アカウント毎に閲覧できるディレクリーを変更したい場合に使います。

前提

ここでは、vsftpd で chroot するためだけの設定を説明します。
vsftpdは、その他の設定により、外部ファイルが、許可リストになったり拒否リストになったり紛らわしいので注意が必要です。

設定

具体的な設定は以下の通り。

vsftpd.conf
# chrootのlistを有効にする。
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd/chroot_list

# userlist設定
userlist_enable=YES
userlist_deny=NO
userlist_file=/etc/vsftpd/user_list

# このディレクトリーに、ユーザー名の個別の設定ファイルを作成する
user_config_dir=/etc/vsftpd/user_conf
chroot_list
# ここに列挙したユーザー名がchrootの対象になる
foo
bar
user_list
# userlist_deny=NO  だと許可(allow)リストになる
# userlist_deny=YES だと拒否(deny)リストになる
admin
foo
bar
user_conf/foo
# このディレクトリーより上には移動できない
local_root=/www/foo.com
user_conf/bar
# このディレクトリーより上には移動できない
local_root=/www/bar.com

トラブルシューティング

500 OOPS: vsftpd: refusing to run with writable root inside chroot()

chrootした先に書き込み権限があるとエラーになる。設定で回避できる。

vsftpd.conf
allow_writeable_chroot=YES
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0