Introduction
Pure-FTPd is a secure, fast, and easily configurable FTP server commonly used on Linux and Unix-like systems. However, you may sometimes encounter an "Active: failed (Result: timeout)" error after installation or update. This error indicates that the Pure-FTPd service could not be started and timed out. This guide will help you understand the causes of this problem and apply step-by-step solutions. Correct FTP server installation, configuration, and security settings are critical to preventing such errors.
1. Causes of Error and Basic Checks
1.1. Network Connection Problems
One of the most common causes is problems with the server's network connection. Check if the server has internet access. DNS resolution issues can also cause this error.
- Solution: Test the internet connection with the
ping google.com
command. If you cannot ping, check your network settings. Make sure the correct DNS servers are defined in the/etc/resolv.conf
file.
1.2. Firewall Settings
The firewall may be blocking FTP traffic. Make sure that the ports used by Pure-FTPd (usually 21 and a dynamic port range for passive mode) are open in the firewall.
- Solution: Check the settings of
iptables
,firewalld
, or other firewall software you are using. For example, if you are usingfirewalld
, you can allow FTP service to pass through with the following commands:
sudo firewall-cmd --permanent --add-service=ftp
sudo firewall-cmd --reload
1.3. Incorrect Configuration File
The pure-ftpd.conf
file may be configured incorrectly. Incorrect parameters in this file can prevent the service from starting.
- Solution: Carefully examine the
/etc/pure-ftpd/pure-ftpd.conf
file. Check for incorrect or missing lines. In particular, make sure that parameters such asPassivePortRange
andForcePassiveIP
are set correctly.
1.4. Port Conflict
Port 21 may be used by another service. In this case, Pure-FTPd cannot be started.
- Solution: Check which service is using port 21 with the
netstat -tulnp | grep :21
command. If another service is using it, stop that service or run Pure-FTPd on a different port.
1.5. Insufficient System Resources
The server may have insufficient system resources such as memory or processor. In this case, the Pure-FTPd service may time out.
- Solution: Monitor system resource usage with the
top
orhtop
commands. If resources are overloaded, stop unnecessary services or provide more resources to the server.
1.6. Disk Space Issues
Running out of disk space can prevent Pure-FTPd from writing log files or creating temporary files. This can prevent the service from starting.
- Solution: Check disk space with the
df -h
command. If the disk is full, delete unnecessary files or expand the disk space.
2. Systemd Related Issues
2.1. Service File Accuracy
The systemd
configuration file (pure-ftpd.service
) for the Pure-FTPd service may be incorrect.
- Solution: Check the
/lib/systemd/system/pure-ftpd.service
or/etc/systemd/system/pure-ftpd.service
file. Make sure parameters such asExecStart
,User
, andGroup
are set correctly.
2.2. Reloading Systemd Daemon
The systemd
daemon may need to be reloaded after configuration changes.
- Solution: Reload the
systemd
daemon and restart the Pure-FTPd service using the following commands:
sudo systemctl daemon-reload
sudo systemctl restart pure-ftpd
2.3. Checking Service Status
Checking the status of the service can help determine the source of the problem.
- Solution: Check the status of the service with the
sudo systemctl status pure-ftpd
command. Examine the error messages and look for clues for a solution.
3. Reviewing and Correcting the Configuration File
3.1. Basic Configuration Parameters
Make sure the following parameters are set correctly in the pure-ftpd.conf
file:
Listen
: The IP address and port the FTP server will listen on.PassivePortRange
: The port range to be used for passive mode.ForcePassiveIP
: The IP address to be used in passive mode.PureDB
: The path to the user database.AnonymousOnly
: Whether only anonymous access is allowed.NoAnonymous
: Whether anonymous access is blocked.
3.2. Sample Configuration File
Below is an example of a basic pure-ftpd.conf
file:
Listen 192.168.1.10:21
PassivePortRange 30000 30100
ForcePassiveIP 192.168.1.10
PureDB /etc/pure-ftpd/pureftpd.pdb
AnonymousOnly no
NoAnonymous no
MaxClientsNumber 50
MaxClientsPerIP 5
3.3. Testing the Configuration File
After making changes to the configuration file, it is important to test the file.
- Solution: Test the configuration file with the
pure-ftpd -t
command. Examine the error messages and make corrections.
4. User Accounts and Permissions
4.1. Checking the User Database
Pure-FTPd stores user accounts in a database. Make sure that this database is created correctly and that users have the correct permissions.
- Solution: Display the user's information with the
pure-pw show
command. If necessary, add, edit, or delete users with thepure-pw useradd
,pure-pw usermod
,pure-pw userdel
commands. - Important: After making changes to the database, recreate the database with the
pure-pw mkdb
command.
4.2. Checking File Permissions
Make sure that the files and directories that users are trying to access have the correct permissions.
- Solution: Check the permissions of files and directories with the
ls -l
command. If necessary, change the permissions and ownership with thechmod
andchown
commands.
5. Passive Mode Issues and Solutions
5.1. Correctly Setting the Passive Port Range
Make sure that the port range used for passive mode is open in the firewall and set correctly in the configuration file.
- Solution: Set the
PassivePortRange
parameter correctly in thepure-ftpd.conf
file. Usually, a range such as 30000-30100 or 49152-65534 is used. Don't forget to open this range in the firewall.
5.2. Specifying the External IP Address
Specify the server's external IP address with the ForcePassiveIP
parameter. This is especially important for servers behind NAT.
- Solution: Set the
ForcePassiveIP
parameter with the server's external IP address. If the server has a dynamic IP address, you can use a DNS service to associate it with a domain name.
5.3. NAT and Forwarding Settings
If the server is behind a NAT, make the necessary port forwardings in the router to forward FTP traffic to the server.
- Solution: In your router's settings, forward port 21 and the passive port range to the server's local IP address.
6. Examining Log Files
6.1. Location of Log Files
Pure-FTPd log files are usually located in the /var/log/syslog
or /var/log/pure-ftpd/
directory.
6.2. Examining Log Files
By examining log files, you can determine the cause of errors. For example, failed login attempts, file permission issues, or network connection problems can be seen in the log files.
- Solution: Monitor log files in real-time with the
tail -f /var/log/syslog
ortail -f /var/log/pure-ftpd/pureftpd.log
commands. Examine error messages and look for clues for a solution.
7. Real-Life Examples and Case Studies
7.1. Case Study 1: Firewall Issue
A user was getting a "Timeout" error after installing Pure-FTPd. Upon examining the log files, they found that the connections were being blocked by the firewall. The problem was resolved after allowing the FTP service through the firewall.
7.2. Case Study 2: Passive Mode Configuration
Another user was trying to run Pure-FTPd on a server behind NAT. They were experiencing connection problems because they had not configured passive mode correctly. The problem was resolved after correctly setting the ForcePassiveIP
parameter and performing the necessary port forwarding on the router.
8. Visual Explanations (Textual Descriptions)
8.1. FTP Connection Diagram
An FTP connection takes place between the client and the server over two channels: the control channel (port 21) and the data channel (dynamic port range in passive mode). The control channel is used to send commands and receive responses, while the data channel is used for file transfer.
8.2. Firewall Diagram
The firewall controls incoming and outgoing traffic, preventing unauthorized access. For FTP traffic to pass smoothly, port 21 and the port range used for passive mode must be open in the firewall.
9. Frequently Asked Questions
- 9.1. How do I restart Pure-FTPd?
- You can restart Pure-FTPd with the command
sudo systemctl restart pure-ftpd
. - 9.2. How do I configure passive mode?
- You can configure passive mode by setting the
PassivePortRange
andForcePassiveIP
parameters in the/etc/pure-ftpd/pure-ftpd.conf
file. - 9.3. How do I add a user?
- You can add a user with the command
pure-pw useradd -u -d
. Then, don't forget to recreate the database with thepure-pw mkdb
command. - 9.4. Why am I getting a "Timeout" error?
- The "Timeout" error can be caused by various reasons such as network connection problems, firewall settings, incorrect configuration file, port conflict, or insufficient system resources. You can identify and resolve the source of the problem by following the steps in this guide.
- 9.5. Which ports do I need to open?
- You need to open port 21 for FTP and the port range you configured for passive mode (e.g., 30000-30100) in the firewall.
10. Conclusion and Summary
The Pure-FTPd "Timeout" error is a complex problem that can be caused by various reasons. In this guide, we have addressed the possible causes of this problem and step-by-step solutions in detail. Checking network connection problems, adjusting firewall settings, examining the configuration file, checking user accounts and permissions, correctly configuring passive mode, and examining log files are the basic steps you need to take to solve the problem. I hope this guide helps you resolve the Pure-FTPd "Timeout" error and run a secure, fast, and reliable FTP server.
Important Notes:
- Before making any changes, back up the configuration files.
- When running commands, make sure you have the correct user rights (you usually need to use
sudo
). - If the problem persists, refer to the Pure-FTPd documentation and forums.
Additional Information and Resources
Tables
Table 1: Pure-FTPd Configuration Parameters Comparison
Parameter | Description | Default Value |
---|---|---|
Listen |
IP address and port the FTP server will listen on. | All IP addresses (0.0.0.0) and port 21 |
PassivePortRange |
Port range to be used for passive mode. | (Usually not set, random ports are used) |
ForcePassiveIP |
IP address to be used in passive mode. | (Not set) |
PureDB |
Path to the user database. | /etc/pure-ftpd/pureftpd.pdb |
AnonymousOnly |
Whether to allow only anonymous access. | no |
NoAnonymous |
Whether to prevent anonymous access. | no |
Table 2: Pure-FTPd Error Codes and Meanings
Error Code | Description | Possible Solutions |
---|---|---|
421 | Service not available, closing connection. | Check if the server is overloaded, increase resources. |
530 | Not logged in. | Check the username and password, ensure the user database is configured correctly. |
550 | File not found or access denied. | Check file permissions, ensure the user has access to the correct directory. |
425 | Can't open data connection. | Check passive mode configuration, adjust firewall settings. |
426 | Connection closed; transfer aborted. | Check the network connection, ensure the server has a stable connection. |