前两天在公司的服务器上配了一个ftp服务器,用的是vsftpd。
今天同事和我说不能创建目录也不能上传文件。
表现为使用mkdir提示:
550 Create directory operation failed.
使用put提示:
553 Could not create file.
登上去一看,果然如此。只有ls命令还能用,于是ls一下,看看有什么文件、目录之类没有,发现没有任何文件存在嘛,于是ssh远程登录上去创建一个文件夹,但是在ftp客户端中ls还是没有显示出来。据此猜测应该是ftp服务器没有改变到用户目录去。
在google上搜索之,找到一个vsftpd的配置说明。http://vsftpd.beasts.org/vsftpd_conf.html
有此段:
chroot_local_user
If set to YES, local users will be (by default) placed in a chroot() jail in their home directory after login. Warning: This option has security implications, especially if the users have upload permission, or shell access. Only enable if you know what you are doing. Note that these security implications are not vsftpd specific. They apply to all FTP daemons which offer to put local users in chroot() jails.
Default: NO
配上之后重启服务器,登录,提示 vsftpd 500 OOPS: chroot
在google之找到http://www.linuxquestions.org/questions/linux-networking-3/ftp-500-oops-cannot-change-directory-432558/
于是知道是selinux的问题,它有一个叫做”Allow ftp to read/write in the user home directories” 的选项。使用如下命令
/usr/sbin/setsebool -P ftp_home_dir 1
打开选项,重启服务器,登录,一切ok了。
感谢google,感谢…你懂的。
Related posts:





#1 by test on 07/09/2010 - 15:31
test for comment email