One silly chmod question

Bohdan Sydor bohdan at harazd.net
Thu Jan 14 16:36:21 UTC 2010


ESGLinux wrote:
> I have a webserver with the user apache being the owner of all under
> /opt/www/.
> One more thing, when I update one file, it changes the owner and group of
> the file to the user that I use to connect.

> I use this:
> rsync -azv -e 'ssh ' --delete /locatpatch/* user2 at server:/opt/www/

> any idea?

The easiest way (but not the ultimate one) is rsync the files as root.
Root can both change the ownership and permissions of files. To do it
more securely I'd recommend to disable password login for user root via ssh.

Another (IMHO better) way is to try such configuration:

/opt/www owned by user2 and group ie. webmasters, chmod 2770 /opt/www
and add user apache to group webmasters. Then, under /opt/www all files
will be owned by user2:webmasters. If apache is to modify some files,
they must be group-writable.

regards
-- 
Bohdan Sydor
RHC{E,I,X}
www.sydor.net




More information about the redhat-list mailing list