centos7 配置 vsftpd 失败!

需求

1)让用户可以使用FTP软件登录到网站,进行上传下载
2)但是他只能看到网站下的,不能超出网站目录!

安装

用的是vsftpd

yum install vsftpd
systemctl start vsftpd
systemctl enable vsftpd

问题

按照网上说的 https://www.liberiangeek.net/2014/08/install-vsftpd-ftp-server-centos-7/ 配置vsftpd,修改了/etc/vsftpd/vsftpd.conf 重启结果一直报错:

[root@niche vsftpd]# systemctl restart vsftpd
Job for vsftpd.service failed. See 'systemctl status vsftpd.service' and 'journa                
lctl -xn' for details.
[root@niche vsftpd]# systemctl restart vsftpd.service
Job for vsftpd.service failed. See 'systemctl status vsftpd.service' and 'journa                
lctl -xn' for details.
[root@niche vsftpd]# systemctl status vsftpd.service
vsftpd.service - Vsftpd ftp daemon
   Loaded: loaded (/usr/lib/systemd/system/vsftpd.service; disabled)
   Active: failed (Result: exit-code) since Tue 2014-12-16 16:32:09 UTC; 15s ago
  Process: 13586 ExecStart=/usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf (code=exited                
, status=1/FAILURE)

Dec 16 16:32:09 niche systemd[1]: vsftpd.service: control process exited, c...=1
Dec 16 16:32:09 niche systemd[1]: Failed to start Vsftpd ftp daemon.
Dec 16 16:32:09 niche systemd[1]: Unit vsftpd.service entered failed state.
Hint: Some lines were ellipsized, use -l to show in full.
[root@niche vsftpd]# systemctl start vsftpd
Job for vsftpd.service failed. See 'systemctl status vsftpd.service' and 'journalctl -xn' for de
[root@niche vsftpd]# journalctl -xn
-- Logs begin at Tue 2014-12-16 06:28:59 UTC, end at Tue 2014-12-16 16:33:26 UTC. --
Dec 16 16:31:49 niche systemd[1]: Failed to start Vsftpd ftp daemon.
-- Subject: Unit vsftpd.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit vsftpd.service has failed.
--
-- The result is failed.
Dec 16 16:31:49 niche systemd[1]: Unit vsftpd.service entered failed state.
Dec 16 16:32:06 niche systemd[1]: Starting Vsftpd ftp daemon...
-- Subject: Unit vsftpd.service has begun with start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit vsftpd.service has begun starting up.
Dec 16 16:32:09 niche systemd[1]: vsftpd.service: control process exited, code=exited status=1
Dec 16 16:32:09 niche systemd[1]: Failed to start Vsftpd ftp daemon.
-- Subject: Unit vsftpd.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit vsftpd.service has failed.
--
-- The result is failed.
Dec 16 16:32:09 niche systemd[1]: Unit vsftpd.service entered failed state.
Dec 16 16:33:23 niche systemd[1]: Starting Vsftpd ftp daemon...
-- Subject: Unit vsftpd.service has begun with start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit vsftpd.service has begun starting up.
Dec 16 16:33:26 niche systemd[1]: vsftpd.service: control process exited, code=e
Dec 16 16:33:26 niche systemd[1]: Failed to start Vsftpd ftp daemon.
-- Subject: Unit vsftpd.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit vsftpd.service has failed.
--
-- The result is failed.
Dec 16 16:33:26 niche systemd[1]: Unit vsftpd.service entered failed state.
lines 6-42/42 (END)
--
-- Unit vsftpd.service has failed.
--
-- The result is failed.
Dec 16 16:31:49 niche systemd[1]: Unit vsftpd.service entered failed state.
Dec 16 16:32:06 niche systemd[1]: Starting Vsftpd ftp daemon...
-- Subject: Unit vsftpd.service has begun with start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit vsftpd.service has begun starting up.
Dec 16 16:32:09 niche systemd[1]: vsftpd.service: control process exited, code=e
Dec 16 16:32:09 niche systemd[1]: Failed to start Vsftpd ftp daemon.
[root@niche vsftpd]#


阅读 47.4k
4 个回答

出现错误的原因是:由于centos7中vsftp的配置文件默认将 listen_ipv6=YES 这一行没有注释掉,而我们目前的网络环境还不支持ipv6,从而导致出现错误无法启动,所以解决方法是将 listen_ipv6=YES更改为:listen_ipv6=NO,或将这一行注释掉

按上面的方法注释掉 listen_ipv6=YES后,成功启动vsftp

直接用/etc/init.d/vsftpd启动
配置如下:


anon_world_readable_only=NO
anonymous_enable=NO
chroot_local_user=YES
guest_enable=NO
guest_username=ftp
hide_ids=YES
listen=YES
listen_address=192.168.1.200
local_enable=YES
max_clients=500
max_per_ip=200
nopriv_user=ftp
pam_service_name=ftp
pasv_max_port=65535
pasv_min_port=64000
session_support=NO
use_localtime=YES
user_config_dir=/etc/vsftpd/users
userlist_enable=YES
userlist_file=/etc/vsftpd/denied_users
xferlog_enable=YES
anon_umask=0007
local_umask=0022
async_abor_enable=YES
connect_from_port_20=YES
dirlist_enable=NO
download_enable=NO
reverse_lookup_enable=NO
dual_log_enable=YES
vsftpd_log_file=/var/log/vsftpd.log

有时可能是selinux影响,不允许访问sslkey文件,执行如下命令放开限制

setsebool -P ftp_home_dir=1   //设置ftp可以使用home目录
setsebool -P allow_ftpd_full_access=1   //设置ftp用户可以有所有权限
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
宣传栏