vsftpd.conf配置如下:
anonymous_enable=YES
local_enable=YES
write_enable=YES
anon_upload_enable=YES
anon_mkdir_write_enable=YES
anon_other_write_enable=YES
anon_root=/var/ftp/pub/
anon_umask=022
listen=YES
用匿名用户anonymous登录之后到能到默认路径/var/ftp/pub/下载东西,但是上传的时候总是报错,“Could not create file”!
百度、谷歌搜索出来的结果很多,绝大部分都说配置文件有问题,但是配置文件怎么看都没问题。自己仔细想了下,发现是上传目录的权限有问题。
drwxr-xr-x 2 root root 4096 Oct 9 15:37 pub
该目录的权限是755,所有者是root,root用户能读写操作,所属组和其他用户(我们使用的是匿名帐号anonymous)都没有w(写)权限,也就自然不能创建文件了。改下该目录的权限#chmod 777 pub,就能上传文件,上传的文件权限是644,因为设置了anon_umask=022。