用VMware虚拟了一个CentOS 7 ,安装完成之后,开始配置FTP服务器
先使用yum命令
yum -y install vsftpd , 没有问题,安装成功
然后启动FTP服务
service vsftpd start
[root@localhost vsftpd]# service vsftpd start
Starting vsftpd (via systemctl): Job for vsftpd.service failed because the control process exited with error code. See "systemctl status vsftpd.service" and "journalctl -xe" for details.
[失败]
接着查看状态
systemctl status vsftpd.service命令
[root@localhost vsftpd]# systemctl status vsftpd.service
● vsftpd.service - Vsftpd ftp daemon
Loaded: loaded (/usr/lib/systemd/system/vsftpd.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since 二 2018-04-10 18:54:01 CST; 1min 30s ago
Process: 6057 ExecStart=/usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf (code=exited, status=2)
先是禁掉防火墙,还是有问题,然后再找
问题出在配置文件,IPv6不能用,但默认是打开的,要注释掉
我的配置文件:
anonymous_enable=YES
anon_upload_enable=YES
anon_other_write_enable=YES
anon_mkdir_write_enable=YES
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
xferlog_file=/var/log/xferlog
xferlog_std_format=YES
ftpd_banner=Welcome to blah FTP service.
listen=YES
listen_port=21
pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES
pasv_enable=YES
use_localtime=YES
搞完这些,再启动就OK了,但是上传下载都会遇到权限问题,我是直接匿名用户
用root用户把pub目录直接搞成777,要注意的是用匿名用户上传的文件,下载文件都不好用
最好自己建一个“test”用户
[root@localhost selinux]# useradd -d /var/ftp/pub/aaa test
限定目录我没有设置,需要在配置文件中,拉下来设置test用户密码
[root@localhost selinux]# passwd test
直接修改下来应该就不会有别的问题了,版本不同,也可能会遇到不同的问题,之前用RHEL就没有这个问题