VSFTPD, 553 Could not create file. – permissions?

I’ve set up vsftpd on Amazon EC2 with the Amazon Linux AMI. I created a user and can now successfully connect via ftp. However, if I try to upload something I get the error message

553 Could not create file.

I assume this has to do with permissions, but I don’t know enough about it to be able to fix it. So basically, what do I have to do to be able to upload files?

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

Could you try this

chown -R ftpusername /var/www/html

Method 2

There are two likely reasons that this could happen — you do not have write and execute permissions on the directories leading to the directory you are trying to upload to, or vsftpd is configured not to allow you to upload.

In the former case, use chmod and chown as appropriate to make sure that your user has these permissions on every intermediate directory. The write bit allows the affected user to create, rename, or delete files within the directory, and modify the directory’s attributes, whilst the read bit allows the affected user to list the files within the directory. Since intermediate directories in the path also affect this, the permissions must be set appropriately leading up to the ultimate destination that you intend to upload to.

In the latter case, look at your vsftpd.conf. write_enable must be true to allow writing (and it is false by default). There is good documentation on this configuration file at man 5 vsftpd.conf.

Method 3

The command ftp put /path/to/local_file doesn’t work with vsftpd. Try the following:

ftp put /path/to/local_file remote_file_name

You may choose any name you wish for the remote_file_name, but you must specify one.

Method 4

The FTP home directory (ftp_home_dir) is most likely turned off in SeLinux. To see status of your ftpd control files, issue: getsebool -a and locate the ftpd section. You may notice ftp_home_dir is turned off. To turn it on, use the following command: setsebool -P ftp_home_dir=1

Verify your input using getsebool -a, then Try the upload again.

Note:
Ignore the punctuation marks

Method 5

I had the same issue and fixed changing SELinux to allow writing in the folder I configured to be used by vsftp = /var/ftp/pub.

These links can be helpful:

If you don’t want to go further with your SELinux do not change it, so you will see as default /etc/selinux/config

SELINUX=enforcing

then just run the commands as root or with sudo:
sudo setsebool -P ftpd_anon_write 1
sudo setsebool -P ftpd_full_access 1

as already described above in other comment.

Method 6

Check your vsftpd.conf for this setting:

guest_enable=YES # set it to NO then restart the vsftpd service.

If it’s set to YES, it will also cause the 553 Could not create file.

From: http://www.vsftpd.beasts.org/vsftpd_conf.html

guest_enable If enabled, all non-anonymous logins are
classed as “guest” logins. A guest login is remapped to the user
specified in the guest_username setting.

Default: NO

Method 7

Try this

chmod 757 -R /var/www/html

Method 8

The next parameter will give ftpd access to write anywhere:

setsebool -P ftpd_full_acess=true

Do not use ftpd_anon_write unless you want anonymous uploads to be allowed.

Method 9

In my case problem was with filesystem.

There was a space but filesystem run out of inodes
df -i

# df -i
Filesystem      Inodes   IUsed  IFree IUse% Mounted on
/dev/xvdf1     3276800 3276800      0  100% /ftp-data01

Method 10

For Fedora23 run the commands:

setsebool -P ftpd_anon_write 1 
setsebool -P ftpd_full_access 1

It worked for me.

Method 11

Another possibility : check disk quotas for the user/group

ext:

repquota -a

xfs:
xfs_quota -x -c 'report' /mount_point

Method 12

You are likely to have unsupported characters in filename

Method 13

In my case, the ftp user had no permissions in the directory it was in.

I just had forgotten to cd into the target directory, which I did have the right permissions for.

Method 14

In my case (CentOS7 + vsftpd) changing directory permissions to 775 by command “chmod 775 /home/user/ftpdir/” not helped.

I checked selinux status by command “sestatus”, it was enabled, i list ftp related options: “getsebool -a|grep ftp”

and enabled the disabled option ftpd_full_access by command “setsebool ftpd_full_access on”. Then it started writing the file.

Method 15

nano /etc/vsftpd.conf

# modify these lines
write_enable=YES
chroot_local_user=YES

# add these lines
userlist_enable=YES
userlist_file=/etc/vsftpd.userlist

add the user to /etc/vsftpd.userlist
usermod --home /var/www/html/ username
chown -R username /var/www/html
chmod -R 755 /var/www/html

7 is user, 5 is group, 5 is other

7 is binary 111, 5 is binary 101

111 = read (yes), write (yes), execute (yes)

101 = read (yes), write (no), execute (yes)

So, the user can read, write, execute but other people can’t write.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments