Report this

What is the reason for this report?

VSFTP File Transfer Failed, Error 451

Posted on April 26, 2017

Command: STOR phase1.php Response: 150 Ok to send data. Response: 451 Failure writing to local file. Error: File transfer failed

I’m using FileZilla, and had no issues without using SFTP for the last several days. After performing consecutive uploads with bug fixes it gives me the error above. I have no idea what to do anymore.

I’ve the done following:

  • sudo chown -R ftp:ftp /var/www
  • restarted vsftpd and apache2
  • sudo chmod 777 -R /var/www
  • and reinstalled the LAMP stack

Nothing seems to be working and it was working just fine prior to last night. I’ve been doing socket connections for a project and thought maybe I exceeded the max connections so I reset the box, and my PC. Nothing changed.

I’m at a loss and would appreciate any help.

Note: It was working fine for 5 days up until last night. I don’t need suggestions to use SFTP, I don’t want to right now.

Thanks.



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi @derekrynd

The problem on the control panel is currently being investigated: https://twitter.com/digitalocean/status/857315015308824578

VSFTP should log to somewhere - perhaps /var/log/vsftp.log - have a look in the log to see if it will give you more information.

Solved the 451 issue. Log file in /var/log/apache2 was 28 GB in size, deleted, problem solved.

For anyone else stumbling upon this, while the error has been found, I’ll try to expand a little more on it for other cases.

The error message “451 Failure writing to local file” in VSFTPD typically points to issues on the server-side where the FTP service is running. The issue might be related to disk space, file system permissions, or the FTP server’s configuration. Here are some steps to help you troubleshoot and hopefully resolve the issue:

1. Check Disk Space

Before diving into more complex troubleshooting, ensure that the server has enough disk space to accept new files. Use the df command to check disk space usage:

df -h

Look for the mount point /var/www is on and check if it’s nearly full.

2. Verify Permissions and Ownership

Although you’ve set permissions to 777 and changed ownership, it’s good to verify:

  • Permissions: Check if the permissions have indeed been set properly on /var/www. Overly permissive settings (777) are not recommended for security reasons, but for troubleshooting, you can check them:
ls -ld /var/www

Ownership: Make sure that the directory ownership is correct. The owner should be the user under which VSFTPD is running. This might not necessarily be ftp:ftp depending on your VSFTPD configuration:

ls -l /var/www

3. Check for Open Files and Inodes

If there is a large number of open files or if your inodes are used up, it can prevent new files from being created:

  • Check Open Files Limit:
ulimit -n
  • Increase if necessary.

  • Check Inode Usage:

df -i
  • If you are running out of inodes, you might need to clean up some files.

4. Review VSFTPD Logs

VSFTPD logs could provide more insights into what’s going wrong. Check the VSFTPD log file, usually located at /var/log/vsftpd.log or similar. Look for any error messages around the time the file transfer failed:

grep -i error /var/log/vsftpd.log

5. Review VSFTPD Configuration

There might be configuration directives in VSFTPD related to file writing, such as anon_upload_enable, write_enable, and others. Verify these settings in your vsftpd.conf:

  • Configuration File Check:
cat /etc/vsftpd.conf | grep write_enable
  • Make sure write_enable=YES is uncommented.

6. SELinux Context (if applicable)

If you are on a system with SELinux enabled, it could be interfering with VSFTPD’s ability to write files:

  • Check SELinux Status:
getenforce
  • heck File Context:
ls -Z /var/www
  • Adjust SELinux Policy: If SELinux is causing issues, adjust the policy or set the proper context for /var/www or consider setting SELinux to permissive mode temporarily to test:
setenforce 0

7. FileSystem Issues

There might be underlying file system issues. Run a file system check (be careful with mounted or live file systems):

sudo fsck /dev/sdaX

Replace /dev/sdaX with your actual partition.

8. Restart VSFTPD

After making changes, ensure you restart the VSFTPD service:

sudo systemctl restart vsftpd

9. Try a Different Client or Method

Sometimes, the issue could be with the FTP client. Try using another FTP client or command-line FTP to see if the issue persists. This can help isolate whether the problem is with FileZilla or the server setup.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.