Issue with public access to web server

So, I am not use to setting up a web server so i’m sure there is an easy explanation for this that I don’t know.

Basically, anytime I upload a new file via ftp, the www-data user can not view it until I do

chmod -R 775 /var/www

I have to do this every single time when I upload a file, is there anyway to make it so that they can read any file uploaded in this directory?


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

As Woet says, use SFTP yet you need to upload with the intended user for such website, not with root or any other user.

You need to check your folder has the right permissions and umask (which usually you don’t need to mess with).

if you use site1 user to upload, make sure your site main folder and subfolders has permissions for site1 (user) and apache (user).

Google for default permissions if you have been messing around.

Use SFTP instead of FTP.