TL;DR
Someone is trying to guess passwords to your FTP server. This guide shows you how to stop them, find out if they’ve already got in, and make things more secure.
Steps to Protect Your FTP Server from Brute Force Attacks
- Understand the Threat
- A brute force attack is where someone tries many different usernames and passwords until they find one that works.
- FTP servers are often targeted because weak credentials are common.
- Check Your FTP Server Logs
Look for failed login attempts from the same IP address. This is a strong sign of an attack.
- The location of logs varies depending on your server software (e.g., vsftpd, ProFTPd, FileZilla Server).
- Common log file names include
ftp.logor similar. - Use tools like
grepto search for failed login attempts:grep "Failed login" /var/log/ftp.log
- Implement Fail2Ban (Recommended)
Fail2Ban automatically blocks IP addresses that show malicious signs, like too many failed logins.
- Install Fail2Ban: On Debian/Ubuntu:
sudo apt updatesudo apt install fail2banOn CentOS/RHEL:
sudo yum install epel-releasesudo yum install fail2ban - Configure Fail2Ban for FTP: Create a local configuration file (e.g.,
/etc/fail2ban/jail.local) and add or modify the following:[ftp]enabled = trueport = ftp,21filter = ftplogpath = /var/log/ftp.logmaxretry = 3bantime = 600 - Restart Fail2Ban:
sudo systemctl restart fail2ban
- Install Fail2Ban: On Debian/Ubuntu:
- Limit Login Attempts
Configure your FTP server to limit the number of login attempts per IP address within a certain timeframe.
- This is usually done in your FTP server’s configuration file (e.g.,
vsftpd.conf). - The specific settings depend on your software; consult its documentation.
- This is usually done in your FTP server’s configuration file (e.g.,
- Use Strong Passwords
Ensure all users have strong, unique passwords.
- At least 12 characters long.
- A mix of uppercase and lowercase letters, numbers, and symbols.
- Avoid dictionary words or personal information.
- Consider Key-Based Authentication
Key-based authentication is much more secure than passwords.
- Users log in using a private key instead of a password.
- Requires more technical setup but significantly reduces the risk of brute force attacks.
- Disable Anonymous Login
Unless absolutely necessary, disable anonymous login to prevent unauthorized access.
- This is usually a setting in your FTP server’s configuration file.
- Keep Your Software Updated
Regularly update your FTP server software and operating system to patch security vulnerabilities.
- Use an Intrusion Detection System (IDS)
An IDS can detect suspicious activity on your server, including brute force attacks.
- Examples include Snort or Suricata.

