mkdir: 无法创建目录 `/usr/share/empty': 文件已存在
如果需要开启匿名用户访问,需要做下面几步工作
3. 编译源代码及安装 [root@redhat vsftpd-2.3.2]# make //编译二进制文件
问题1.
在执行make命令时却出现了问题,具体如下: make: *** [vsftpd] 错误 1
解决方法: 打开Makefile vim Makefile LIBS = `./vsf_findlibs.sh` 末尾增加 -lcrypt 变成 LIBS = `./vsf_findlibs.sh` -lcrypt
问题2
install: cannot create regular file `/usr/local/man/man8/vsftpd.8': No such file or directory
install: cannot create regular file `/usr/local/man/man5/vsftpd.conf.5': No such file or directory
make: *** [install] Error 1
解决方法:
root@ubuntu:/home/linting/work/tools/vsftpd-3.0.2# mkdir /usr/local/man/man5
root@ubuntu:/home/linting/work/tools/vsftpd-3.0.2# mkdir /usr/local/man/man8
root@ubuntu:/home/linting/work/tools/vsftpd-3.0.2# make install
if [ -x /usr/local/sbin ]; then \
install -m 755 vsftpd /usr/local/sbin/vsftpd; \
else \
install -m 755 vsftpd /usr/sbin/vsftpd; fi
if [ -x /usr/local/man ]; then \
install -m 644 vsftpd.8 /usr/local/man/man8/vsftpd.8; \
install -m 644 vsftpd.conf.5 /usr/local/man/man5/vsftpd.conf.5; \
elif [ -x /usr/share/man ]; then \
install -m 644 vsftpd.8 /usr/share/man/man8/vsftpd.8; \
install -m 644 vsftpd.conf.5 /usr/share/man/man5/vsftpd.conf.5; \
else \
install -m 644 vsftpd.8 /usr/man/man8/vsftpd.8; \
install -m 644 vsftpd.conf.5 /usr/man/man5/vsftpd.conf.5; fi
if [ -x /etc/xinetd.d ]; then \
install -m 644 xinetd.d/vsftpd /etc/xinetd.d/vsftpd; fi
4. 安装、编辑配置
[root@redhat vsftpd-2.3.2]# cp vsftpd.conf /etc/ //将默认配置文件考贝到/etc/
[root@redhat vsftpd-2.3.2]# vi /etc/vsftpd.conf
[root@redhat vsftpd-2.3.2]# cp vsftpd.conf.5 /usr/local/man/man5
配置vsftpd服务
vsftpd有两种工作模式,standalone模式和xinetd守护进程模式,第1行就是让其工作在standalone模式下。此种模式中,每次 修改配置文件必须重新启动vsftpd服务才能生效,关于两种模式在后面有详细介绍。我们安装时还把 Redhat 目录下的 vsftpd.pam 文件复制成了/etc/pam.d/vsftpd 文件。这个文件就是本地用户登陆的 pam 验证配置文件。关于这个文件我们会在后面具体介绍。这里我们要知道,必须得有这个配置文件,而且主配置文件里要加上 pam_service_name=vsftpd语句,我们才能让本地用户登陆。用以下命令启动服务: [root@redhat vsftpd-2.3.2]# /usr/local/sbin/vsftpd & //后台启动vsftp
问题3: 500 OOPS: bad bool value in config file for: anonymous_enable 看似配置文件错误,看了一下配置相应的行: anonymous_enable=NO 语句没什么错误,不过把这行注释后又到下一行报错,看来是整个文件都有问题,百度了一下,大部分都是说语句后面不能有多余的空格,但是用VI看来不了行末是否有多余的字符,干脆把配置文件下载下来,发现这个文件是一般PC(WINDOWS,CRLF)的格式的,所文件改为UNIX(LF)格式再上传,VSFTP就可以启动了
以下 sed 调用将把 DOS/Windows 格式的文本转换成可信赖的 UNIX 格式: $ sed -e 's/.$//' mydos.txt > myunix.txt
怎么查看一个既有文件的格式: unix上: file filename
为保证服务确实启动,我们用如下命令检测: [root@redhat vsftpd-2.3.2]# netstat -an |grep 22tcp 0 0 0.0.0.0:21 0.0.0.0:* LISTEN 我们看到服务器已经打开了tcp21端口,表明ftp确实已经启动。
再登录服务器:
使用如下命令关闭ftp服务: [root@redhat vsftpd-2.3.2]# pgrep vsftpd //查看vsftpd服务器是否已经关闭
开机自启动
service vsftpd restart 重启vsftpd服务 |