vsftp upload 553 Could not create file error resolution

  • 2020-06-19 12:37:11
  • OfStack

Set up an ftp server. I used the ubuntu 10.04 operating system and downloaded the vsftpdy source code.

Compiled, installed, and then created users according to the INSTALL file.

Due to the tight time, I used anonymous users to upload files for the test. Modified /etc/ vsftpd.conf file,

Remove the default comment that does not allow anonymous users to upload files, save it, kill the vsftpd process, and rerun it

$ sudo vsftpd &

Start the ftp server.

With 1 client, you can connect normally, but always report 553 Could not create file error message when uploading files.

I also set the permissions on the /var/ftp directory according to the online practice, if set to ES39en-ES40en 777 /var/ftp

It would also cause the ftp server to fail to start. After some trial and error, a solution was finally found.

First create 1 directory in the ftp directory and then set the permissions to 777

$ sudo mkdir /var/ftp/write

$sudo chmod -R 777 /var/ftp/write

Then modify the vsftp configuration file /etc/ vsftpd.conf file

Add at the end

local_root=/var/ftp

Save, then kill the vsftpd process, and then restart the vsftpd server program.

Try uploading the file to the write directory and you will be able to upload the file normally.

Let's take a look at the solutions of other netizens:

First of all, it depends on what kind of user you are using, if it's a regular user:

1. To determine whether the target folder has access to read and write (of course, there must also be access to execute, otherwise the folder cannot be opened)

2 If you have both, then selinux is restricted. Turn off selinux. (setenforce 0)

For anonymous users:

As above, turn off selinux and give the appropriate permissions

Here's a solution to not turning off the selinux

First run getsebool-a | grep ftp (see selinux for ftp)

allow_ftpd_anon_write -- > off

allow_ftpd_full_access -- > off

allow_ftpd_use_cifs -- > off

allow_ftpd_use_nfs -- > off

ftp_home_dir -- > off

ftpd_connect_db -- > off

httpd_enable_ftp_server -- > off

sftpd_anon_write -- > off

sftpd_enable_homedirs -- > off

sftpd_full_access -- > off

sftpd_write_ssh_home -- > off

tftp_anon_write -- > off

So let's go to allow_ftpd_anon_write allow_ftpd_full_access

setsebool -P allow_ftpd_anon_write on

setsebool -P allow_ftpd_full_access on

So that's OK, if it comes up

500 OOPS: vsftpd: refusing to run with writable anonymous root

500 OOPS: priv_sock_get_cmd

You gave 777 permissions in the root directory of VSFTPD, change it to 755, and then create a folder in this directory, you can give 777 permissions!


Related articles: