Default Folder Permissions

Hi Everyone,

I have a question about permissions :)

Is it possible to somehow setup a directory so that anything put in it will have the same permissions? Sometimes I put stuff in my public_html directory and the permissions are weird. I would like to make them consistent, if possible, without having to chmod every time I upload files.

Thanks in advance for your help,

2 Replies

what you can do is use the setgid bit. man chmod.

just as an example:

find ./public_html -type d -exec chgrp www-data {} \;

find ./public_html -type d -exec chmod g+ws {} \;

I'm not sure what group you want to set.

Instead of cp, you could scp them to localhost:/targetdir as the target user eliminating the step to change their ownership.

I'm not sure if that's what you're asking for.

Reply

Please enter an answer
Tips:

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] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct