Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 04-15-2014, 02:28 PM   #1
Registered: Aug 2012
Posts: 737

Rep: Reputation: Disabled
Configure Samba to create files of given permission

If I create a directory or file from a Windows PC on a Samba shared linux folder, they have the following permissions.

drwxrwxr-x.  2 phped phped 4096 Apr 15 05:28 test
-rwxrw-r--.  1 phped phped    0 Apr 15 05:24 test.php
I am okay with the owner/group as well as the directory permissions, however, I wish the file to be -rwxrwxr-x.

How can I do this? My /etc/samba/smb.conf file is:
server string = Samba Server Version %v

# interfaces = lo wlan0
hosts allow = 127. 192.168.0.

log file = /var/log/samba/log.%m
max log size = 50

security = user
passdb backend = tdbsam

        comment = Apache WWW Directory
        path = /var/www
        public = no
        # valid users = phped
        read only = no
        writable = yes
        browseable = yes
        create mask = 0775
        create mode = 0775
        directory mode = 0775
        share modes = yes
Thank you
Old 04-15-2014, 03:30 PM   #2
LQ Addict
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,898

Rep: Reputation: 353Reputation: 353Reputation: 353Reputation: 353
If I'm not mistaken, you need to make an addition to the [global] section of samba.conf. Something like this:
# If you want to create files with owner=rwx, group=rwx, other=rx permissions, set 
# create mask to 0775.
   create mask = 0775
1 members found this post helpful.
Old 04-15-2014, 03:43 PM   #3
Registered: Dec 2013
Posts: 344

Rep: Reputation: Disabled
I suspect those are the linux permissions set on the folder on the server side. Try "force create mode = 775"
1 members found this post helpful.
Old 04-16-2014, 06:36 AM   #4
Registered: Aug 2012
Posts: 737

Original Poster
Rep: Reputation: Disabled
Since I already have "create mask = 0775" in the specific shared folder, I don't think it is necessary in the global section. I guess it is a good idea to put it there so all individual folders inherit it.

"force create mode = 775" did the trick.

I still don't understand why both "force create mode" and "create mask" (synonym for "create mode") for used for files, and "force directory mode" and "directory mask" (synonym for "directory mode") are used for directories.

According to,
When a file (or directory) is created, the necessary permissions are calculated according to the mapping from DOS modes to UNIX permissions, and the resulting UNIX mode is then bit-wise 'AND'ed with this parameter. This parameter may be thought of as a bit-wise MASK for the UNIX modes of a file. Any bit not set here will be removed from the modes set on a file when it is created.
Where are these DOS modes coming from? What is the point to force a value only to mask it?


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
create lock files - permission denied on mounted filesystem (NFS) the_bigbalu Linux - Server 0 02-28-2012 07:09 AM
[SOLVED] [SAMBA] How to track windows user access , create files /modify files on linux SMB efciem Linux - Server 2 05-16-2010 09:45 AM
permission settings umask / samba create mask eRJe Linux - Server 2 02-22-2010 07:08 AM
samba and file create permission noir911 Linux - Server 1 04-02-2009 09:17 AM
SAMBA ERROR: cannot create regular file `~/tux016.pdf': Permission denied mokele Linux - Software 5 02-07-2007 05:37 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:00 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration