I’ve spend almost an hour trying to isolate a problem that persisted with slow ftp transfers .
First I thought the slowness is because of some kind of firewall rules, anyways I’ve tested disabling the iptablesfirewall rules and the effect was absolutely the same.
I was able to login normally to the newly configured vsftp server on Debian installed through:
debian-server:~# apt-get install vsftpd
The vsftp is configured to run as a stand alone service and not via inetd. A copy from the non-working vsftpd.conf can be obtained from here
I couldn’t find any fault or misconfigured variable in the above mentioned ftp configuration file.
The file doesn’t contain neither a syntax nor logical errors. The Vsftpd service was running as a daemon perfectly fine.
I read online about some suggestions that something could be wrong with my /etc/hosts.allow or /etc/hosts.deny files but neither of them doesn’t contained any deny rules.
Though I tried entering the following line to /etc/hosts.allow:
vsftpd: ALL: ALLOW
Guess what nothing changed, the uploading slowness and the error message:
421 Service not available, remote server timed out. Connection closed
was at hand.
I tried even transffering data files on localhost whilest the firewall was disabled using:
debian-server:~# ftp 0
Connected to 0 (0.0.0.0).
user: hipo
pass: *********
ftp>put file.tar.gz
229 Entering Extended Passive Mode
150 Ok to send data.
421 Service not available, remote server timed out. Connection closed
I also tried raising up the data_connection_timeout which by default was equal to 120 secs to data_connection_timeout=720
This doesn’t help as well. Lest that I tried also to fix the issue through changes in the following vsftp variables:
connect_from_port_20=NO
xferlog_enable=NO
local_max_rate=50max_per_ip=40
max_clients=50
Nomatter what I tried the shitty transfer timeout error was determined to reappear:
421 Service not available, remote server timed out. Connection closed
Pretty much like problems passing through an arcade game super-boss ! ghh ..
Following some forum suggestions that might help resolving the error I tried also the vsftpd conf variables:
pasv_enable=YES
pasv_min_port=11000
pasv_max_port=11010
Again the 421 Service not available, remote server timed out. Connection closed during a file transfer occured!
That completely pissed me off, so I did a radical decision. Just wipe out vsftpdand exchange it for the easier to implement and less problematic good old PROFTPD
My experience with proftpd as a server ftp daemon was most of times positive. It was luckily like this also this time!
The swith to proftpd on the server was a piece of a sweety cake:
debian-server:~# apt-get install proftpd
There you go now transfer works and the 421 Service not available, remote server timed out. Connection closed is solved in a radical and very easy manner!
Yet if you continue experiencing some kind of data transfer errors or ftp login errors I recommend you load the nf_conntrack_ftp if you’re running linux kernel > 2.19, if you’re using an older kernel version then you should load the ip_conntrack_ftp kernel module.
To make kernel loadable during system boot time do execute:
debian-server:~# echo nf_conntrack_ftp >> /etc/modules
To prevent FTP data transactions caused by iptables firewall rules I suggest you also check my article Iptables Open FTP Port 21 and 20 to enable your Linux firewall in and out FTP server data transfer to flow
More helpful Articles
Tags: remote server has closed connection with vsftp and it's solution, vsftp 421 Service not available
Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.111 Safari/537.36
Add/enable this line in /etc/vsftpd.conf
seccomp_sandbox=NO
Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36
thx Andrej
View CommentView Comment