首先安装一下服务
# yum install -y vsftpd
# /etc/init.d/vsftpd start
# chkconfig vsftpd on
# chkconfig --list vsftpd
vsftpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
1.我们要做的是/var/ftp/pub 目录,让次目录可以上传
#chown ftp /var/ftp/pub
# chcon -Rt public_content_rw_t /var/ftp/pub
# getsebool -a |grep ftp
allow_ftpd_anon_write --> off
allow_ftpd_full_access --> off
allow_ftpd_use_cifs --> off
allow_ftpd_use_nfs --> off
ftp_home_dir --> off
ftpd_connect_db --> off
httpd_enable_ftp_server --> off
sftpd_anon_write --> off
sftpd_enable_homedirs --> off
sftpd_full_access --> off
sftpd_write_ssh_home --> off
tftp_anon_write --> off
//修改allow_ftpd_anon_write=on
# setsebool -P allow_ftpd_anon_write on
//修改vsftpd主配置文件
# vim /etc/vsftpd/vsftpd.conf
anon_upload_enable=YES
# /etc/init.d/vsftpd restart
#lftp localhost
lftp localhost:~> cd pub/
lftp localhost:/pub> ls
lftp localhost:/pub> put /etc/fstab
863 bytes transferred
2.如果要实现下载功能,还需要添加几个选项
现在直接下载的话,会失败!
lftp localhost:/pub> get fstab
get: Access failed: 550 Failed to open file. (fstab)
我们可以man vsftpd.conf 查找我们所需要的选项
可以看到anon_world_readable_only这项的默认值是yes
#vim /etc/vsftpd/vsftpd.conf
anon_world_readable_only=NO
# /etc/init.d/vsftpd restart
# !lftp
lftp localhost
lftp localhost:~> cd pub/
lftp localhost:/pub> ls
-rw------- 1 14 50 863 Sep 07 03:05 fstab
lftp localhost:/pub> get fstab
863 bytes transferred
3.实现匿名删除功能
#vim /etc/vsftpd/vsftpd.conf
添加anon_other_write_enable=YES
# /etc/init.d/vsftpd restart
# !lftp
lftp localhost:/> cd pub/
lftp localhost:/pub> ls
-rw------- 1 14 50 863 Sep 07 03:05 fstab
lftp localhost:/pub> rm fstab
rm ok, `fstab' removed
lftp localhost:/pub> ls
好了,到这里,我们的匿名上传,下载,删除就已经实现了!
阅读(2085) | 评论(0) | 转发(0) |