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:
listen=YES(server listens on IPv4)anonymous_enable=NO(disable anonymous access)local_enable=YES(allow local users)write_enable=YES(permit file uploads)chroot_local_user=YES(restrict users to their home directories)allow_writeable_chroot=YES(allow writes in chrooted directories)
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:
- Directory permissions:
755(owner: read/write/execute; group/others: read/execute) - File permissions:
644(owner: read/write; group/others: read-only)
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
If the server is unreachable, investigate network issues (e.g., router configurations, ISP restrictions).
7. Address Common Error Scenarios
- Error 530 (Login Incorrect): Verify the username/password is correct and
local_enable=YESis set in the config file. - Error 501 (Syntax Error): Check for typos in the configuration file (e.g.,
listen=YESmisspelled). - Connection Timeouts: Ensure the firewall isn’t blocking passive mode ports (add
pasv_min_portandpasv_max_portinvsftpd.confand open these ports in the firewall).
8. Restart the FTP Service
After making changes to the configuration or permissions, always restart the service to apply updates:
sudo systemctl restart vsftpd
以上就是关于“Ubuntu FTP Server故障排除”的相关介绍,筋斗云是国内较早的云主机应用的服务商,拥有10余年行业经验,提供丰富的云服务器、租用服务器等相关产品服务。云服务器资源弹性伸缩,主机vCPU、内存性能强悍、超高I/O速度、故障秒级恢复;电子化备案,提交快速,专业团队7×24小时服务支持!
简单好用、高性价比云服务器租用链接:https://www.jindouyun.cn/product/cvm