Linux下的vsftpd配置详解
配置环境:Redhat Linux AS 3 + Vsftpd
主要是配置有ftpadmin(管理员),ftpupload(上传,下载,浏览),ftpdownload(下载,浏览)这几个用户。
软件在安装AS3时默认给安装了。
1.建立配置文件:
#cat </etc/vsftpd/logins.txt
>ftpadmin ----------用户名
>ftpadmin ----------密码
>ftpupload
>ftpupload
>ftpdownload
>ftpdownload
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
2,生成口令文件
#db_load -T -t hash -f /etc/vsftpd/logins.txt /etc/vsftpd/vsftpd_login.db
#chmod 600 /etc/vsftpd/vsftpd_login.db
- 1.
- 2.
- 3.
- 4.
3,建立认证文件
#vi /etc/pam.d/vsftpd.vu
auth required /lib/security/pam_userdb.so db=/etc/vsftpd/vsftpd_login
account required /lib/security/pam_userdb.so db=/etc/vsftpd/vsftpd_login
#wq
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
4,建立用户目录及权限
#useradd -d /home/ftpsite virtual
#chmod 700 /home/ftpsite
- 1.
- 2.
- 3.
- 4.
5,修改配置文件/etc/vsftpd/vsftpd.conf
Linten=YES
anonmous_enable=YES
local_enable=YES
write_enable=NO
anon_upload_enable=NO
anon_mkdir_write_enable=NO
anon_other_wirte_enable=NO
one_process_model=NO
chroot_local_user=YES
guest_enable=YES
guest_username=virtual
pam_service_name=vsftpd.vu
#wq
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
- 21.
- 22.
- 23.
- 24.
- 25.
- 26.
5.重启vsftpd服务
#service vsftpd restart
- 1.
- 2.
6.对各个用户权限的设定
编辑/etc/vsftpd/vsftpd.conf, 添加user_config_dir选项
user_config_dir=/etc/vsftpd/vsftpd_user_conf
- 1.
- 2.
保存文件
#mkdir /etc/vsftpd/vsftpd_user_conf
#echo < /etc/vsftpd/vsftpd_user_conf/ftpadmin
>anon_world_readable_only=NO
>write_enable=YES
>anon_upload_enable=YES
>anon_mkdir_write_enable=YES
>anon_other_write_enable=YES
>!
#echo < /etc/vsftpd/vsftpd_user_conf/ftpupload
>anon_world_readable_only=NO
>write_enable=YES
>anon_upload_enable=YES
>!
#echo < /etc/vsftpd/vsftpd_user_conf/ftpdownload
>anon_world_readable_only=NO
>!
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
- 21.
- 22.
- 23.
- 24.
- 25.
- 26.
- 27.
- 28.
- 29.
- 30.
- 31.
- 32.
7.然后重启vsftpd服务即可
【编辑推荐】