ubuntu

Ubuntu FTP Server故障排除

小樊
46
2025-10-23 16:51:39
栏目: 智能运维

Ubuntu FTP Server Fault Troubleshooting

1. Verify FTP Service Status

The first step in troubleshooting is confirming whether the FTP service (vsftpd) is running. Use the command:

sudo systemctl status vsftpd

If the service is inactive (stopped), start it with:

sudo systemctl start vsftpd

To ensure it starts automatically on boot, enable it:

sudo systemctl enable vsftpd

2. Check Firewall Settings

Firewalls often block FTP traffic, preventing client connections. For ufw (Ubuntu’s default firewall), allow FTP ports (21 for control, 20 for data) and enable the firewall:

sudo ufw allow 21/tcp
sudo ufw allow 20/tcp
sudo ufw enable

Verify the rules are applied:

sudo ufw status

If using iptables, ensure similar rules are in place.

3. Validate Configuration File Syntax

The main configuration file for vsftpd is /etc/vsftpd.conf. Common critical parameters include:

After modifying the file, test for syntax errors and restart the service:

sudo dpkg-reconfigure vsftpd  # or sudo systemctl restart vsftpd

4. Inspect Log Files for Errors

Logs provide detailed clues about failures. For vsftpd, check:

sudo tail -f /var/log/vsftpd.log  # Primary FTP logs
sudo journalctl -xe                # System-wide logs (filter by "vsftpd")

Look for entries like “530 Login incorrect” (authentication issues) or “permission denied” (file access problems).

5. Confirm User Permissions

Ensure FTP users have correct permissions for their home directories. The user’s home directory (e.g., /home/ftpuser) should have:

Adjust permissions with:

sudo chown ftpuser:ftpuser /home/ftpuser  # Set ownership
sudo chmod 755 /home/ftpuser              # Set directory permissions

Also, verify the user exists in the system and has a valid shell (e.g., /bin/bash).

6. Test Network Connectivity

Ensure the server is reachable from the client. Use ping to check network connectivity:

ping <server_ip>

If the server is unreachable, investigate network issues (e.g., router configurations, ISP restrictions).

7. Address Common Error Scenarios

8. Restart the FTP Service

After making changes to the configuration or permissions, always restart the service to apply updates:

sudo systemctl restart vsftpd

0
看了该问题的人还看了