0

I had trouble fixing the file uploading, but then I ran chmod a+w /var/www and it worked - files were being uploaded to my specified directory.

However, my script also generates a thumbnail immediately after the file is uploaded. This part is not working. I'm assuming that the files uploaded by the script are locked (they have a small lock appearing near them when going to the directory manually) and it can't grab the uploaded file and create a new thumbnail file based on it.

I'm not getting any error or something.

How do I edit the permissions in the way that lets me create new files using "locked" files?

aborted
  • 269
  • 1
  • 4
  • 17
  • 1
    Please, please please do not make /var/www world writeable! – terdon May 13 '14 at 15:39
  • Modify your script to set permissions after generating a thumb nail. In addition, rather then making /var/www world rw, use an upload dorectory, such as /var/www/images . Use the lowest lever of permissions possible. I keep files owned by root with ro access and allow www-data rwx access only on critical files. I lock down php as well. – Panther May 13 '14 at 15:47

1 Answers1

0

You just need to work out your permissions correctly. If this is a web application than the user doing the file manipulation is probably www-data. So all files and directories need to be owned by the www-data group and user. And www-data should have full permissions for those files and directories.

  1. Give www-data ownership of all files and dirs in DocumentRoot: sudo chown -R www-data:www-data /var/www.

  2. Change permission so www-data has rwx priveleges: sudo chmod -R 775 /var/www.

  3. Add yourself to the www-data group so you can make changes as well: sudo adduser <username> www-data. Logout and back in.

  4. Read up on unix privileges and maybe tweak the permission within /var/www to be a bit tighter.

Dan
  • 6,753
  • 5
  • 26
  • 43