FTP failure on Ubuntu Server

1

1

I am still learning Ubuntu 16.04. Here is my situation with ftp failure. I installed vsftpd on my Unbuntu server two months ago and when I was working on it the past Sunday, everything was fine. But now I try to connect to ftp but obtain the result "Connection refused", like this:

ftp: connect to address ::1: Connection refused
Trying 127.0.0.1...
ftp: connect: Connection refused  

Here is what /var/log/syslog says:

Jun 27 19:36:22 ubuntu systemd[1]: Starting vsftpd FTP server...
Jun 27 19:36:22 ubuntu systemd[1]: Started vsftpd FTP server.
Jun 27 19:36:22 ubuntu systemd[1]: vsftpd.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Jun 27 19:36:22 ubuntu systemd[1]: vsftpd.service: Unit entered failed state.
Jun 27 19:36:22 ubuntu systemd[1]: vsftpd.service: Failed with result 'exit-code'.  

I've searched online for solutions and tried but with no good result. I've also checked the iptables, they are empty like this:

Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination  

...which means nothing being hold in the iptables, right?... and this is my vsftpd.conf:

listen=YES
listen_ipv6=YES
anonymous_enable=YES
local_enable=YES
write_enable=YES
anon_upload_enable=YES
anon_mkdir_write_enable=YES
dirmessage_enable=YES
use_localtime=YES
xferlog_enable=YES
connect_from_port_20=YES
xferlog_file=/var/log/vsftpd.log
chroot_local_user=YES
secure_chroot_dir=/var/run/vsftpd/empty
pam_service_name=vsftpd
rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
ssl_enable=NO
guest_enable=YES
guest_username=workers
user_config_dir=/etc/vsftpd/userconfig/
user_sub_token=$USER
local_root=/home/work/$USER
hide_id=YES
allow_writeable_chroot=YES
local_umask=022
pasv_enable=YES
pasv_min_port=64000
pasv_max_port=65535   

I really have no clue of what's wrong with vsftpd on my server.

gabi

Posted 2017-06-28T07:29:50.417

Reputation: 13

What command did you use to start fsftpd, and is there anything in /var/log/vsftpd.log or /var/log/syslog ? Also, have a look athttps://unix.stackexchange.com/questions/181436/vsftpd-wont-start#310010 - maybe you need to chown root:root /etc/vsftp.conf

– davidgo – 2017-06-28T08:16:16.483

Most of the time, i use sudo service vsftpd restart to restart vsftpd, also use sudo /etc/init.d/vsftpd restart to restart. Yes, I've looked at that link before I posted my question here 'cuz it doesn't help. And the permission for /etc/vsftpd.conf is root root. – gabi – 2017-06-28T08:34:56.690

Answers

1

I installed vsftpd with your config file to reproduce on my Ubuntu 16.04. Usually, when you don't have enough information in the logs when you start the service, you can try and execute the executable directly. In the present case, this gives:

$ vsftpd
500 OOPS: unrecognised variable in config file: hide_id

Which can be fixed by removing the line containing "hide_id".

Re-running, you will encounter another issue:

$ vsftpd
500 OOPS: run two copies of vsftpd for IPv4 and IPv6

Which can be fixed by removing either "listen_ipv6=YES" or "listen=YES".

Gohu

Posted 2017-06-28T07:29:50.417

Reputation: 757

Thank you, Gohu! It worked! All in all, it's about the configuration file etc/vsftpd.conf. At first, I commented hide_id and changed listen=YES to listen=NO, but it gaves me 500 OOPS: could not bind listening IPv6 socket. Then I changed back to listen=YES and commented listen_ipv6=YES. After restart vstpd, $ ftp localhost, though it still showed ftp: connect to address ::1: Connection refused Trying 127.0.0.1..., but what follows thrills me: Connected to localhost. 220 (vsFTPd 3.0.3) and Name (localhost:netlab):. Appreciate it! – gabi – 2017-06-28T08:50:21.583