vsftpd-cannot read config file even when file exists

I'm on Ubuntu 15.04 and I just installed vsftpd. When I run the command service vsftpd status, I get the following output:

vsftpd.service - vsftpd FTP server Loaded: loaded (/lib/systemd/system/vsftpd.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Fri 2015-10-09 19:18:50 IST; 3min 11s ago Process: 2981 ExecStart=/usr/sbin/vsftpd /etc/vsftpd.conf (code=exited, status=2) Process: 2979 ExecStartPre=/bin/mkdir -p /var/run/vsftpd/empty (code=exited, status=0/SUCCESS) Main PID: 2981 (code=exited, status=2) Oct 09 19:18:50 harshal-Lenovo-B40-70 systemd[1]: Starting vsftpd FTP server... Oct 09 19:18:50 harshal-Lenovo-B40-70 systemd[1]: Started vsftpd FTP server. Oct 09 19:18:50 harshal-Lenovo-B40-70 systemd[1]: vsftpd.service: main process exited, code=exited, status=2/INVALIDARGUMENT Oct 09 19:18:50 harshal-Lenovo-B40-70 systemd[1]: Unit vsftpd.service entered failed state. Oct 09 19:18:50 harshal-Lenovo-B40-70 systemd[1]: vsftpd.service failed. 

I checked /etc/vsftpd.conf, it exists and I did not find anything wrong in it. How can I solve this?

2

7 Answers

I had the same symptoms while trying to start vsftpd on an Ubuntu 16.04. In my case it was enough to comment out this line in /etc/vsftpd.conf:

listen_ipv6=YES 

I don't know why i does not work with ipv6 for me, but I have no need for IP-v6 and disabling it solved the problem in my case.

1

step 1 : check the vsftpd.conf

listen=YES local_enable=YES write_enable=YES local_umask=022 dirmessage_enable=YES use_localtime=YES xferlog_enable=YES secure_chroot_dir=/var/run/vsftpd/empty pam_service_name=vsftpd rsa_cert_file=/etc/ssl/private/vsftpd.pem 

Step 2 : To View which ftp service is running use

$ lsof -i | grep ftp 

step 3 : To stop xinetd

$ sudo service xinetd stop 

Step 4: After stoping xinetd restart your vsftpd service by typing

$ /etc/init.d/vsftpd restart 
1

In addition to some of the other solutions (listen_ipv6=NO and listen=YES), mine was failing with the same error because I had included comments after the things I had modified:

listen_ipv6=NO # modified 

That was also causing the same status=2/INVALIDARGUMENT error. Could only figure it out by running the daemon directly:

$ sudo /usr/sbin/vsftpd /etc/vsftpd.conf 500 OOPS: bad bool value in config file for: listen_ipv6 

Neither systemctl/service nor /var/log/vsftpd.log were any use.

Solution was to remove the trailing comment:

listen_ipv6=NO 

This can be fixed by commenting out:

listen_ipv6=yes 

and I am now active on vsftpd.

None of these solutions worked for me. I even have SELinux disabled so that was not the cause and the config file for vsftpd is 100% perfect because service vstfpd start works instantly but it just would not start at startup.

My final solution was this bash script which runs with cron continually checking the service and works perfectly now and starts vsftp on startup by checking and seeing the service is dead and then starting it.

#!/bin/bash service=vsftpd if (( $(ps -ef | grep -v grep | grep $service | wc -l) > 0 )) then echo "$service is running!!!" else service vsftpd start fi 

And then my cron is

* * * * * sudo /usr/sbin/startvsftpd.sh 
1

vsftpd needs the /etc/vsftpd.conf to be owned by root. Check who owns it with

ls -la /etc 

To change the owner run the following command as as root or via sudo

chown root /etc/vsftpd.conf 

You can see /etc/vsftpd.conf. This file configuration Listen=YES,If you setting,,You use vsftpd start serivce. You can try. I have encountered this problem, I was so resolved, I hope you can help.

1

You Might Also Like