chmod to make the webserver dirs writeable by the web server

What is the best command/setting for this? I don't want files to be accessible by other users who aren't admins, but I believe this might be done through SFTP jails.

3 Replies

chown root: chmod 0770 Enjoy your jail.


chown root: chmod 0770 Enjoy your jail.

So it would be

chown root:sudo /home/sasha/web_servers
chmod 0770 /home/sasha/web_servers

What do each of the numbers for the chmod do? I'm only used to three numbers.

Normally the first 0 in that chmod is ignored, unless you give it explicitly like that.

This is the special mode, you can give it a 4 for setuid(e.g chmod 4770), a 2 for setgid, or a 1 for a sticky bit. They can be combined (e.g. setgid + sticky bit would be 3770)

As a sidenote I personally use 0710 with user:www-data on the folders.


Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct