This example shows how to extend the "VIRTUAL_USERS" example to reflect a slightly more complex setup. ここでは、すこし複雑な設定として、"VIRTUAL_USERS" を展開する方法につい て書きます。 Let's assume that we want two types of virtual user - one that can only browse and download content, and another that can upload new content as well as download existing content. ふたつのタイプのバーチャルユーザを必要とするケースを考えてみましょう。 ひとつは、ディレクトリのブラウズとファイルのダウンロードだけができる ユーザで、もうひとつは、それに加えてファイルのアップロードができるユ ーザです。 To achieve this setup, we can use use of vsftpd's powerful per-user configurability (new in v1.1.0). この要求を実現するためには、vsftpd の強力なユーザ毎設定機能を使うこと ができます。 In the previous virtual user example, we created two users - tom and fred. Let's say that we want fred to have write access to upload new files whilst tom can only download. ここで、ふたつのユーザを tom と fred とし、fred はファイルのアップロー ドができ、tom はダウンロードしかできないものとします。 Step 1) Activate per-user configurability. (ユーザ毎設定の有効化) To activate this powerful vsftpd feature, add the following to /etc/vsftpd.conf: この強力な機能を有効にするには、次の設定を /etc/vsftpd.conf に加えます。 user_config_dir=/etc/vsftpd_user_conf And, create this directory: mkdir /etc/vsftpd_user_conf Step 2) Give tom the ability to read all files / directories. (tom に 対して / ディレクトリのファイルを読む権限を与える) At the end of the last example, we noted that the virtual users can only see world-readable files and directories. We could make the /home/ftpsite directory world readable, and upload files with world-read permission. But another way of doing this is giving tom the ability to download files which are not world-readable. 前項の設定では、バーチャルユーザは world-readable な (無制限アクセス権 限が設定されたファイルとディレトリについてのみアクセスできるようになっ ています。このようなディレクトリとして、/home/ftpsite を指定すると、無 制限アクセス権限でファイルをアップロードすることができます。これを実現 するには、tom に wold-readable ではないファイルをダウンロードする権限 を与える方法があります。 For the tom user, supply a config setting override for anon_world_readable_only: さらに tom に対して、anon_world_readable_only を設定します。 echo "anon_world_readable_only=NO" > /etc/vsftpd_user_conf/tom Check it out - login as tom and now "ls" will return a directory listing! Log in as fred and it won't. NOTE - restart vsftpd to pick up the config setting changes to /etc/vsftpd.conf. (Advanced users can send SIGHUP to the vsftpd listener process). この状態で、tom でログインすると、ディレクトリをブラウズすることができ ますが、fred でログインしてもそれはできないことを確認してください。 (注意) /etc/vsftpd.conf の変更を反映させるために vsftpd を再起動する必 要があります。 Step 3) Give fred the ability to read all files / directories and create new ones but not interfere with existing files. (fred に ディレクトリ / にある全てのファイルと、新しいファイルを作成する権限を与えます。ただ し既存のファイルの変更は許可しません) echo "anon_world_readable_only=NO" > /etc/vsftpd_user_conf/fred echo "write_enable=YES" >> /etc/vsftpd_user_conf/fred echo "anon_upload_enable=YES" >> /etc/vsftpd_user_conf/fred Check it out - login as tom and you can't upload. Log in as fred and you can! Try and delete a file as both tom and fred - you can't. この状態で、tom でログインすると、ファイルのアップロードはできず、fred でログインするとファイルのアップロードはできる。しかし、tom でも fred でも、ファイルの削除はできないことを確認してください。