vsftpd 3.0.2的一些问题(无法开启服务、无法正常显示文件等功能)

12 篇文章 0 订阅
2 篇文章 0 订阅

关于vsftpd3.0.2正常安装配置关于我遇到的无法启动服务或外部客户端无法连接的问题:

[root@www ~]# systemctl start vsftpd.service
Job for vsftpd.service failed because the control process exited with error code. See "systemctl status vsftpd.service" and "journalctl -xe" for details.
[root@www ~]# journalctl -xe
-- Subject: Unit NetworkManager-dispatcher.service has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit NetworkManager-dispatcher.service has finished starting up.
--
-- The start-up result is done.
8月 27 15:30:51 www.liyi.com nm-dispatcher[22025]: req:1 'dhcp4-change' [enp2s0]: new request (4 scripts)
8月 27 15:30:51 www.liyi.com nm-dispatcher[22025]: req:1 'dhcp4-change' [enp2s0]: start running ordered scripts...
8月 27 15:32:52 www.liyi.com polkitd[760]: Registered Authentication Agent for unix-process:22116:10540009 (system bus name :1.658 [/usr/bin/pkttyagent --notify-fd 5 --
8月 27 15:32:52 www.liyi.com systemd[1]: Stopping Vsftpd ftp daemon...
-- Subject: Unit vsftpd.service has begun shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit vsftpd.service has begun shutting down.
8月 27 15:32:52 www.liyi.com systemd[1]: Stopped Vsftpd ftp daemon.
-- Subject: Unit vsftpd.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit vsftpd.service has finished shutting down.
8月 27 15:32:52 www.liyi.com polkitd[760]: Unregistered Authentication Agent for unix-process:22116:10540009 (system bus name :1.658, object path /org/freedesktop/Polic
8月 27 15:32:56 www.liyi.com polkitd[760]: Registered Authentication Agent for unix-process:22127:10540434 (system bus name :1.659 [/usr/bin/pkttyagent --notify-fd 5 --
8月 27 15:32:56 www.liyi.com systemd[1]: Starting Vsftpd ftp daemon...
-- Subject: Unit vsftpd.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit vsftpd.service has begun starting up.
8月 27 15:32:56 www.liyi.com vsftpd[22133]: 500 OOPS: run two copies of vsftpd for IPv4 and IPv6
8月 27 15:32:56 www.liyi.com systemd[1]: vsftpd.service: control process exited, code=exited status=2
8月 27 15:32:56 www.liyi.com 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.
8月 27 15:32:56 www.liyi.com systemd[1]: Unit vsftpd.service entered failed state.
8月 27 15:32:56 www.liyi.com systemd[1]: vsftpd.service failed.
8月 27 15:32:56 www.liyi.com polkitd[760]: Unregistered Authentication Agent for unix-process:22127:10540434 (system bus name :1.659, object path /org/freedesktop/Polic

[root@www ~]#

vsftpd服务无法正常启动,根据提示输入journalctl -xe查看信息关于什么错误启动啥的,网上查看配置文件是否有更改不对的地方,什么监听改成No,Ipv6改成No,我的配置文件没有修改监听,只更改了IPv6。
查看一下vsftpd.conf文件位置:
使用find命令

[root@www ~]# find /etc/ -name 'vsftpd.conf'
/etc/vsftpd/vsftpd.conf
[root@www ~]# find /etc/ -name vsftpd.conf
/etc/vsftpd/vsftpd.conf
[root@www ~]#

vim文件:
我的没有修改listen,还是listen=YES,但是我修改了IPv6:

 87 ftpd_banner=Welcome to LiYi_File service.
 88 #
 89 # You may specify a file of disallowed anonymous e-mail addresses. Apparently
 90 # useful for combatting certain DoS attacks.
 91 #deny_email_enable=YES
 92 # (default follows)
 93 #banned_email_file=/etc/vsftpd/banned_emails
 94 #
 95 # You may specify an explicit list of local users to chroot() to their home
 96 # directory. If chroot_local_user is YES, then this list becomes a list of
 97 # users to NOT chroot().
 98 # (Warning! chroot'ing can be very dangerous. If using chroot, make sure that
 99 # the user does not have write access to the top level directory within the
100 # chroot)
101 chroot_local_user=YES
102 chroot_list_enable=YES
103 # (default follows)
104 chroot_list_file=/etc/vsftpd/chroot_list
105 #
106 # You may activate the "-R" option to the builtin ls. This is disabled by
107 # default to avoid remote users being able to cause excessive I/O on large
108 # sites. However, some broken FTP clients such as "ncftp" and "mirror" assume
109 # the presence of the "-R" option, so there is a strong case for enabling it.
110 #ls_recurse_enable=YES
111 #
112 # When "listen" directive is enabled, vsftpd runs in standalone mode and
113 # listens on IPv4 sockets. This directive cannot be used in conjunction
114 # with the listen_ipv6 directive.
115 listen=YES
116 #
117 # This directive enables listening on IPv6 sockets. By default, listening
118 # on the IPv6 "any" address (::) will accept connections from both IPv6
119 # and IPv4 clients. It is not necessary to listen on *both* IPv4 and IPv6
120 # sockets. If you want that (perhaps because you want to listen on specific
121 # addresses) then you must run two copies of vsftpd with two configuration
122 # files.
123 # Make sure, that one of the listen options is commented !!
124 listen_ipv6=NO
125
126 allow_writeable_chroot=YES
127 pam_service_name=vsftpd
128 userlist_enable=YES
129 tcp_wrappers=YES

可以看到第124行本身是YES的,修改为NO之后,我的问题就解决了。

[root@www ~]# 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 四 2020-08-27 15:32:56 CST; 9min ago
  Process: 22133 ExecStart=/usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf (code=exited, status=2)
 Main PID: 1250 (code=killed, signal=TERM)

8月 27 15:32:56 www.liyi.com systemd[1]: Starting Vsftpd ftp daemon...
8月 27 15:32:56 www.liyi.com vsftpd[22133]: 500 OOPS: run two copies of vsftpd for IPv4 and IPv6
8月 27 15:32:56 www.liyi.com systemd[1]: vsftpd.service: control process exited, code=exited status=2
8月 27 15:32:56 www.liyi.com systemd[1]: Failed to start Vsftpd ftp daemon.
8月 27 15:32:56 www.liyi.com systemd[1]: Unit vsftpd.service entered failed state.
8月 27 15:32:56 www.liyi.com systemd[1]: vsftpd.service failed.
[root@www ~]# systemctl start vsftpd.service
[root@www ~]# systemctl status vsftpd.service
● vsftpd.service - Vsftpd ftp daemon
   Loaded: loaded (/usr/lib/systemd/system/vsftpd.service; enabled; vendor preset: disabled)
   Active: active (running) since 四 2020-08-27 15:42:48 CST; 4s ago
  Process: 22426 ExecStart=/usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf (code=exited, status=0/SUCCESS)
 Main PID: 22428 (vsftpd)
    Tasks: 1
   CGroup: /system.slice/vsftpd.service
           └─22428 /usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf

8月 27 15:42:48 www.liyi.com systemd[1]: Starting Vsftpd ftp daemon...
8月 27 15:42:48 www.liyi.com systemd[1]: Started Vsftpd ftp daemon.
[root@www ~]#

我的vsftpd服务不提示错误了,我只修改了IPv6的设置。

关于客户端无法访问vsftpd服务器,可以先查看一下服务器的防火墙有没有开启21端口(vsftpd默认端口21):

[root@www ~]# firewall-cmd --list-ports
80/tcp 3306/tcp 21/tcp 3260/tcp

如果客户端能够访问vsftpd的登陆界面,显示列出文件错误,或者网页能够显示服务器用户名密码登陆框但是都无法显示服务器内的文件夹的话可以查看一下关于selinux 的设置问题:

[root@www ~]# netstat -an | grep 21
tcp        0      0 0.0.0.0:21              0.0.0.0:*               LISTEN
unix  2      [ ACC ]     STREAM     LISTENING     25521    private/retry
unix  4      [ ]         DGRAM                    1211     /run/systemd/notify
unix  2      [ ]         DGRAM                    1213     /run/systemd/cgroups-agent
unix  3      [ ]         STREAM     CONNECTED     21570    /run/systemd/journal/stdout
unix  3      [ ]         STREAM     CONNECTED     21599    /run/dbus/system_bus_socket
unix  3      [ ]         STREAM     CONNECTED     21219
unix  2      [ ]         DGRAM                    21005
unix  3      [ ]         STREAM     CONNECTED     21569
unix  3      [ ]         STREAM     CONNECTED     29921
unix  3      [ ]         STREAM     CONNECTED     21598
unix  2      [ ]         DGRAM                    21633
unix  2      [ ]         DGRAM                    21582
unix  2      [ ]         DGRAM                    29212
unix  3      [ ]         STREAM     CONNECTED     26621
unix  3      [ ]         STREAM     CONNECTED     21220    /run/dbus/system_bus_socket
[root@www ~]# getsebool
usage:  getsebool -a or getsebool boolean...
[root@www ~]# getsebool -a | grep ftp
ftpd_anon_write --> off
ftpd_connect_all_unreserved --> off
ftpd_connect_db --> off
ftpd_full_access --> on
ftpd_use_cifs --> off
ftpd_use_fusefs --> off
ftpd_use_nfs --> off
ftpd_use_passive_mode --> off
httpd_can_connect_ftp --> off
httpd_enable_ftp_server --> off
tftp_anon_write --> off
tftp_home_dir --> on
[root@www ~]#

查看一下列出的关于ftp的功能,有两个功能:
ftpd_full_access
tftp_home_dir
这两个功能是否为ON,若为OFF则需要开启两个功能:
使用setsebool -P 【服务名称】 {ON|OFF}
开启ftpd_full_access 服务:

[root@www ~]# setsebool -P ftpd_full_access ON

会有一定的时间,下面不会提示已成功开启等的信息。
这两个服务都开启了之后就能够解决绝大部分无法显示vsftpd的文件信息等问题。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值