So, I am running Debian Stretch with a LAMP server and vsFTPd. When ever I upload a new file or create a new file in the /var/www/html directory with a code editing program, I am unable to view the file/image/what-be-it, until I apply 777 permissions to the /var/www/html folder. I know this is not the best solution but I have ran through several iterations of trying

sudo chown $USER:www-data /var/www/mysite
sudo chmod -R 775 /var/www
sudo usermod -a -G www-data [my username]

and the similar with no luck. How would I go about trouble shooting and eventually solving this issue so I do not need to putty into the server every time I upload some images or a new page to reset permissions.

the www folder has


while any subfolder/file created starts with


After you added $USER to the www-data group and changed the ownership of the /var/www/mysitedirectory, run the following command:

chmod g+s /var/www/mysite

The s attribute will keep all new files and directories created within the mysite directory having the same group ID of the directory, rather than the group ID of the user who created the directory/file.

  • I just attempted this and I have the same result 403 Forbidden – Leo Frost Nov 17 '17 at 23:49

Your Answer

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

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