VSFTPD – Troubleshoot ‘Fails to Start (status=2)’ Error

sslssl-certificatevsftpd

The problem is that the vsftpd service fails to start after transferring a working configuration from another server.

Of vsftpd's configuration files, only these were modified:

  • /etc/vsftpd.chroot_list to add local user names.
  • /etc/vsftpd/vsftpd.conf

The configuration is as follows and (*) indicates changes or additions to the distribution defaults:

anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
xferlog_std_format=YES
ftpd_banner=Hello.
listen=YES (*)
listen_ipv6=NO (*)
pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES
chroot_local_user=YES
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd.chroot_list
dual_log_enable=YES
use_localtime=YES (*)
rsa_cert_file=/path/to/vsftpd.crt (*)
rsa_private_key_file=/path/to/vsftpd.key (*)
ssl_enable=YES (*)
allow_anon_ssl=NO (*)
force_local_data_ssl=NO (*)
force_local_logins_ssl=NO (*)
ssl_tlsv1=YES (*)
ssl_sslv2=NO (*)
ssl_sslv3=NO (*)
require_ssl_reuse=NO (*)
ssl_ciphers=HIGH (*)
ssl_tlsv1_1=YES (*)
ssl_tlsv1_2=YES (*)
allow_writeable_chroot=YES (*)

It is emphasized that the configuration was ported from a working vsftpd instance. The working vsftpd-2.2.2-24.el6.x86_64 instance was on RHEL 6 (CentOS 6) and the new vsftpd-3.0.2-22.el7.x86_64 instance is on RHEL 7 (CentOS 7). In fact, a very similar configuration trivially started on another server.

VSFTP Fails to start CentOS 7 is unhelpful. It is NOT required that listen_ipv6=YES is set as it is only required that one of either listen_ipv6 or listen is set YES and that the other is set NO.
Also, while allow_writeable_chroot=YES was not present on the original working configuration, it is NOT required to simply start vsftpd (though it is essential to resolve a different issue related to migrating the configuration from RHEL 6 to RHEL 7).

$ sudo systemctl status vsftpd
* vsftpd.service - Vsftpd ftp daemon
   Loaded: loaded (/usr/lib/systemd/system/vsftpd.service; disabled;
     vendor preset: disabled)
   Active: inactive (dead)
$ sudo systemctl enable vsftpd
 Created symlink from /etc/systemd/system/multi-user.target.wants/
   vsftpd.service to /usr/lib/systemd/system/vsftpd.service.
$ sudo systemctl start vsftpd
 Job for vsftpd.service failed because the control process exited with
   error code. See "systemctl status vsftpd.service" and "journalctl -xe"
     for details.
$ sudo systemctl -l status vsftpd
 * vsftpd.service - Vsftpd ftp daemon
    Loaded: loaded (/usr/lib/systemd/system/vsftpd.service; enabled;
      vendor preset: disabled)
    Active: failed (Result: exit-code) since Tue 2018-07-31 22:07:56 CDT;
      6min ago
   Process: 10131 ExecStart=/usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf
     (code=exited, status=2)

 Jul 31 22:07:56 host.example.com systemd[1]: Starting Vsftpd ftp daemon...
 Jul 31 22:07:56 host.domain.tld systemd[1]: vsftpd.service: control process exited, code=exited status=2
 Jul 31 22:07:56 host.domain.tld systemd[1]: Failed to start Vsftpd ftp daemon.
 Jul 31 22:07:56 host.domain.tld systemd[1]: Unit vsftpd.service entered failed state.
 Jul 31 22:07:56 host.domain.tld systemd[1]: vsftpd.service failed.

 $ sudo journalct -xe

 Jul 31 22:23:33 host.domain.tld sudo[11537]: user : TTY=pts/0 ; PWD=/etc/vsftpd ; USER=root ; COMMAND=/bin/systemctl start vsftpd
 Jul 31 22:23:33 host.domain.tld polkitd[697]: Registered Authentication Agent for unix-process:11538:187361910 (system bus name :1.13901 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, loc
 Jul 31 22:23:33 host.domain.tld 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.
 Jul 31 22:23:33 host.domain.tld systemd[1]: vsftpd.service: control process exited, code=exited status=2
 Jul 31 22:23:33 host.domain.tld 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.
 Jul 31 22:23:33 host.domain.tld systemd[1]: Unit vsftpd.service entered failed state.
 Jul 31 22:23:33 host.domain.tld systemd[1]: vsftpd.service failed.

Best Answer

In this case, it was fortunate that another server had been started successfully with a very similar working configuration, so conceptually troubleshooting could be done be looking for differences.

Solution: Make absolutely sure any files referenced by the configuration actually exist (or are accessible to the server). For example:

rsa_cert_file=/path/to/vsftpd.crt
rsa_private_key_file=/path/to/vsftpd.key

In the working install, the keys had already been transferred to the system as part of standing up a web server, but on this system, the vsftpd were in a location that had not yet been synced.

Populating the .crt and .key files resolved this error.

Related Topic