I've set up my apache2 server along with vsftpd. A shortcut to the /var/www folder is in /home/pi and I've taken ownership of the folder using:

`sudo chown -R pi /var/www'

When files are uploaded via FTP they are set to permissions: 600

But when viewing this files via the web browser a 403 Forbidden is shown. I can change the file permissions manually but images are uploaded from CCTV cameras 24/7. How can I change this so that the permissions are set automatically?

  • The name you are looking for is "umask". What I don't know is whether vsftpd will respect the umask you set in your default one (check /home/pi/.profile and /etc/profile). Check "man umask" for help on the cryptic 4-digit number.
    – Marco Poli
    May 15, 2014 at 15:42

1 Answer 1


Typically, publicly accessible services (such as nginx/apache or sftp) run as the www-data user. When you changed the owner to pi, you most likely removed permissions for the sftp user.

You should return the permissions to that which they were (ls -lsa /srv/www will give you the actual user/group, as I am making an assumption here):

  • sudo chown www-data:www-data -R /srv/www
  • sudo chmod g+rw -R /srv/www
  • sudo chmod g+s -R /srv/www
  • sudo usermod -a -G www-data pi

Now, the files should be accessible to sftp/web and pi belongs to the www-data group, giving it permission to edit the files.

Be sure you're writing in umask 002 of 007.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.