34

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?

  • Check the selinux Settings. configure boolean allow_ftpd_full_access to ON – user125748 Jul 31 '15 at 12:40
  • i had this issue because there was not enough space to write the files. – Niklas Jul 29 at 10:11

12 Answers 12

20

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.

| improve this answer | |
  • 10
    Neither of these seem to be the issue. I tried chmoding everything to 777 (unsafe) and settings write_enable=YES, but I still get this useless error message. – Cerin Aug 5 '13 at 19:54
  • @Cerin were you able to fix it? If yes, can you share the details? – unknownerror Sep 16 '19 at 9:12
43

Could you try this

chown -R ftpusername /var/www/html
| improve this answer | |
  • 6
    chmod 757 -R /var/www/html – Hernán Eche Nov 5 '15 at 19:49
  • 2
    @HernánEche thanks for the tip, I had been hunting for hours and this finally fixed my issue. – Tr0yJ May 19 '16 at 9:46
  • Could you elaborate on the situation, is this on the server or locally? – Édouard Lopez Mar 28 '17 at 23:22
  • 1
    @HernánEche Hey, It worked for me too, but is it secure. It wasn't working with 755 – viv Mar 31 '17 at 7:42
  • 1
    @HernánEche you should make this a separate answer. Your suggestion worked for me where nothing else did. – Shaul Behr Apr 25 '18 at 11:59
13

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.

| improve this answer | |
  • 2
    You might want to consider adding more detail to your answer (for example, some documentation that supports your solution's validity). – HalosGhost Jun 29 '14 at 3:11
  • This happens because (and if) /path/to/ doesn't exist (and/or isn't accessible through the FTP session) on the server. This is why ftp put local_file does work without explicit destination. (Hint : check the local: … remote: … line in the FTP client.) – Skippy le Grand Gourou May 22 '16 at 9:26
  • 1
    It worked for me! :) – Paulo Jan 11 '18 at 12:51
3

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

| improve this answer | |
2

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.

| improve this answer | |
2

Try this

chmod 757 -R /var/www/html
| improve this answer | |
1

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

| improve this answer | |
0

Another possibility : check disk quotas for the user/group

ext:

repquota -a

xfs:

xfs_quota -x -c 'report' /mount_point
| improve this answer | |
0

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.

| improve this answer | |
0

You are likely to have unsupported characters in filename

| improve this answer | |
0

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.

| improve this answer | |
-1

For Fedora23 run the commands:

setsebool -P ftpd_anon_write 1 
setsebool -P ftpd_full_access 1

It worked for me.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy