[CentOS] Using umask

Wed Jun 22 06:05:22 UTC 2011
Anthony <akcentos at anroet.com>

On 06/22/2011 01:22 AM, Todd Cary wrote:
> Grasping a full understanding of setting default Users, Groups
> and Masks has alluded me over the years, but now I find myself in
> a situation where manually "setting" the file/directory
> attributes is becoming a pain.
>
> I understand the fundamentals of the file attributes, though from
> time to time I have to review the "sticky bit"; what I do not
> understand is where/how the attributes are set when a user
> creates or modifies a file/directory.  Here is my situation:
>
> My /var/www/html files have been manually set by me to
> apache/apache 774.  This allows my PHP applications to access the
> files, and I assume this is a "good" setting.

In your smb.conf file, add the following to the [sharename] section:

force user = apache
force create mode = 0774

This should ensure that all files you dump in via samba are always owned 
by apache with the proper permissions.  I do this on servers that never 
see the internet.  If this is insecure, please enlighten me as said 
servers may one day be made visible to the outside world...

Ak.