VSFTPD上传大于14KB文件超时问题求助
Hey Jack, let's dig into this frustrating upload issue you're having. Both NetBeans and FileZilla failing with files over 14KB points to a systemic problem with your VSFTPD setup, not just a client quirk. Here are the most likely culprits and step-by-step fixes to get you back up and running:
1. Passive Mode Port Configuration (Most Common Cause)
VSFTPD relies on passive mode for large file transfers by default, but if the required port range isn't properly configured or firewalled, transfers will hang once they exceed the initial small packet size.
Fix Steps:
- Open your
vsftpd.conffile with a text editor:sudo nano /etc/vsftpd.conf - Ensure these lines are present and uncommented (adjust ports if needed, but 40000-50000 is a safe range):
pasv_enable=YES pasv_min_port=40000 pasv_max_port=50000 - Save the file and restart VSFTPD:
sudo systemctl restart vsftpd - Allow the port range through UFW (Ubuntu's default firewall):
sudo ufw allow 40000:50000/tcp
Test uploading a large file now—this resolves 90% of similar issues.
2. AppArmor Restrictions
Ubuntu's AppArmor security module might be blocking VSFTPD from using the passive mode ports you just configured.
Fix Steps:
- Check if AppArmor is enforcing rules for VSFTPD:
sudo aa-status - If you see
usr.sbin.vsftpdlisted under "enforce", temporarily switch to complain mode to test:sudo aa-complain /etc/apparmor.d/usr.sbin.vsftpd - Try uploading again. If it works, permanently update the AppArmor profile:
Open/etc/apparmor.d/usr.sbin.vsftpdand add this line inside the braces:network tcp port 40000-50000, - Reload AppArmor to apply changes:
sudo systemctl reload apparmor
3. Disk Space or Inode Exhaustion
Even if you think you have space, a full disk or exhausted inodes (file system metadata) can block large uploads.
Check Commands:
- Verify free disk space for your upload directory's partition:
df -h /path/to/upload/directory - Check inode usage:
df -i /path/to/upload/directory
If either is at 100%, free up space or delete unused files to free inodes.
4. Incorrect Directory Permissions
Your upload directory might not have the right write permissions for the FTP user.
Fix Steps:
- Set the correct owner (replace
ftpuserwith your actual FTP username):sudo chown -R ftpuser:ftpuser /path/to/upload/directory - Set appropriate permissions (read/write for owner, read for others):
sudo chmod -R 755 /path/to/upload/directory
5. VSFTPD Upload Limits
Double-check that your config isn't explicitly restricting upload sizes.
Fix Steps:
- Open
vsftpd.confand look formax_upload_size. If present, set it to a value larger than your target files (e.g.,max_upload_size=100Mfor 100MB files). - Ensure
write_enable=YESis uncommented—this is required for any uploads to work.
If none of these steps resolve the issue, share the exact error lines from your NetBeans FTP log (e.g., timeout messages, connection reset errors) and your full vsftpd.conf content. That will help narrow down more obscure issues like network routing problems or corrupted VSFTPD binaries.
内容的提问来源于stack exchange,提问作者Jack Skeletron

