centos中搭建ftp服务器及配置

来源:互联网 发布:家用饮水机推荐 知乎 编辑:程序博客网 时间:2024/04/30 04:29

安装的话直接yum install vsftp就可以了。

之后启动:/etc/init.d/vsftpd start
或者关闭:
/etc/init.d/vsftpd stop

然后我们去配置ftp服务器,找到这里:

vi /etc/vsftpd/vsftpd.conf

我们可以设置一下匿名用户的权限,比如说不准匿名上传。

然后我们如果觉得目录想自己设定,还可以修改
local_root = /var/ftp/pub/

或者设置下匿名用户的访问目录:

anon_root = /var/ftp/guest/

然后我得到这个错误提示:

unrecognised variable in config file: anon_root

告诉我没有anon_root这个变量…晕啊。

好吧,我找了个遍,都说有anon_root这个目录,那我就试试吧,没想到我把上面那行中间的空格都trim掉后,竟然可以了- -!

就是变成这样:anon_root=/var/ftp/guest

看来在配置文件中配置的时候要小心啊,不是所有配置文件都那么好说话的,有的配置文件就是这么呆板,一板一眼的@_@。

设置之后再次访问果然就被定向到了匿名目录,这时候只能读取,不能修改和上传,很好!

等我解决之后,我看到了这篇文章:http://www.kadimi.com/en/vsftpd-500-oops-unrecognised-variable-in-config-file

哈哈,跟我的情况是一样的,要注意white space before the variable definition.

好吧,很经典的错误,我就把它贴到后面了:

vsftpd: 500 OOPS: unrecognised variable in config file
Question

When I start vsftpd on my CentOs machine I get this error:

Starting vsftpd for vsftpd: 500 OOPS: unrecognised variable in config file: anonymous_enable

How can I fix it?

Answer

The option “anonymous_enable” is a valid vsftpd option, but as you can see on the error message, there is an extra white space before the variable definition, I suspect that the line was there, commented, and that when you uncommented it you forgot to remove the white space after the “#”, check your vsftpd.conf file make sure that “anonymous_enable=YES” or “anonymous_enable=NO” stands on a single line without any preceding spaces then start vsftpd:

service vsftpd start

后来看到的一些好文章:
《Vsftpd完全攻略(一)ftp原理与vsftp安装》
http://viong.blog.51cto.com/844766/261291/

0 0
原创粉丝点击