进入vsftpd配置目录,linux一般在/etc/vsftpd

1.新建users.txt文件(如果不存在的话),添加如下文本.其中基数行为用户名,偶数行为密码

users.txt

test01
123456
test02
654321

2.在/var下分别为每个用户创建一个用户文件夹,分别为test01test02

3.根据users.txt新建用户配置文件.新建users_config文件夹(如果不存在的话),并新建两个文件,分别为test01.txttest02.txt,内容如下:

users_config/test01.txt

local_root=/var/test01
anon_world_readable_only=YES
anon_upload_enable=YES
anon_mkdir_write_enable=YES
anon_other_write_enable=YES

users_config/test02.txt

local_root=/var/test02
anon_world_readable_only=YES
anon_upload_enable=YES
anon_mkdir_write_enable=YES
anon_other_write_enable=YES

4.新建chroot_list文件(如果不存在),在上边加上之前设置的用户名,该文件里的用户将无法查看其local_root以外的目录

chroot_list

test01
test02

5.执行命令将users.txt写入到vsftpd数据库中

db_load -T -t hash -f users.txt users.db

6.最后,测试ftp账号

如无意外,连接后看到的远程站点是/,这是步骤4所起到的作用,否则将会显示为诸如/var/test01这样.

vsftpd.jpg