1

I am facing a little issue: I have created an FTP server with vsftp and a web server with Apache 2.2.

Now, my goal is to make so that anyone can log into the machine via FTP and upload files (.html, .php) so that they are executable by apache.

The point is that they aren't. In fact, the files get created with 600 privileges, and with owner "ftpadmin". Apache returns an error.

Do you know a quick way to fix this?

Jeff Schaller
  • 67,283
  • 35
  • 116
  • 255
Guerriky
  • 133

1 Answers1

2

Apache process started by the user www-data (in Ubuntu, check for Debian).

Those files are created by ftp user. Owened by ftpadmin and have permissions read and write to owner only (group members and others cannot access).

For currently uploaded files

  • Add read and execute permissions to the other users

    sudo chmod o+rx *.php sudo chmod o+rx *.html

(OR)

  • Change the group of the files to www-data and add read and execute permissions to the group users

    sudo chgrp www-data *.php sudo chgrp www-data *.html

    sudo chmod g+rx *.php sudo chmod g+rx *.html

Refer the below link to set default file permissions for future file uploads. How to set default file permissions for all folders/files in a directory?

  • Hi. Sorry for the late response, but SE didn't alert me of these. Your solution works in all cases, except for that the link you provided sets default permissions to subfolders only (thus, I cannot upload in the ftpadmin home folder). I solved this by adding a subfolder and telling our partners to upload there instead. – Guerriky Apr 09 '15 at 12:19