Quote:
|
Originally Posted by dickohead
Surely there has to be someway to specify the default user and group for files under a folder as well as their permissions...?
|
If there is a way of doing that, I'd be happy to know about it. One way I know of setting perms is to use find. To take your case as an example:
cd /var/www
find html -type d -exec chmod 775 {} \+
find html -type f -exec chmod 664 {} \+
That changes permissions on all dirs under and including html to 775. File perms get changed to 664 (I don't advise putting exe perms on files when you don't need to).
Then to change ownership of all files under html:
chown -R tim.www-data html
Where "tim" is the user, "www-data" is the group, "html" is the directory.
Surely you can put these commands in an alias to automate the task.
alias wwwp="find /tmp/test -type d -exec chmod 775 {} \+ && find /tmp/test -type f -exec chmod 664 {} \+ && chown -R tim.www-data /tmp/test"
To build an alias like that, the trick is to write lines separately in an editor, to test them separately and then to combine them into an alias.
Cheers!