Optimizing VSFTPD Transfer Speed on Ubuntu
Adjusting kernel network parameters can significantly improve VSFTPD’s throughput by optimizing buffer sizes and congestion control. Modify /etc/sysctl.conf
with these key settings:
net.core.rmem_max = 16777216 # Max receive buffer size
net.core.wmem_max = 16777216 # Max send buffer size
net.ipv4.tcp_rmem = 4096 87380 16777216 # TCP receive buffer sizes (min/default/max)
net.ipv4.tcp_wmem = 4096 65536 16777216 # TCP send buffer sizes (min/default/max)
net.ipv4.tcp_congestion_control = cubic # Efficient congestion algorithm for high-speed networks
net.ipv4.tcp_no_metrics_save = 1 # Disable saving metrics to reduce overhead
net.ipv4.tcp_low_latency = 1 # Prioritize low-latency over throughput for interactive tasks
Apply changes with sudo sysctl -p
to make them effective immediately.
Fine-tune the VSFTPD configuration file (/etc/vsftpd.conf
) to balance security and performance:
pasv_enable=YES
pasv_min_port=1024 # Lower bound of passive mode port range
pasv_max_port=1048 # Upper bound (adjust to avoid conflicts with other services)
binary_transfer_mode=YES
max_clients=100 # Total concurrent connections (adjust based on CPU/RAM)
max_per_ip=5 # Max connections from a single IP (throttle abuse)
local_max_rate=0 # Unlimited speed for local users (adjust if needed)
anon_max_rate=50000 # Limit anonymous users to 50KB/s (prevent bandwidth hogging)
anonymous_enable=NO
chroot_local_user=NO # Only enable if users need to be restricted to their home directories
After saving changes, restart VSFTPD with sudo systemctl restart vsftpd
.
Upgrade hardware components to eliminate physical bottlenecks:
/mnt/ftp
).Ensure the network infrastructure supports high-speed transfers:
ping
(to test latency) and traceroute
(to identify routing issues) between the client and server. High latency (>50ms) or packet loss (>1%) can significantly reduce transfer speeds.sudo ufw allow 21/tcp
sudo ufw allow 1024:1048/tcp # Passive mode port range (adjust to match VSFTPD config)
sudo ufw enable
vsftpd
’s built-in logging (xferlog_enable=YES
) to track transfer speeds and identify bottlenecks. View logs with tail -f /var/log/vsftpd.log
.lftp
(client) or ncftp
offer features like parallel transfers and compression to boost speed.sudo apt update && sudo apt upgrade vsftpd
).By implementing these optimizations, you can significantly improve VSFTPD’s transfer speed on Ubuntu while maintaining a secure and stable FTP server.