LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 04-15-2014, 02:28 PM   #1
NotionCommotion
Member
 
Registered: Aug 2012
Posts: 565

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.

Code:
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:
Code:
[global]
workgroup=WORKGROUP
server string = Samba Server Version %v

# interfaces = lo wlan0 192.168.0.1/24
hosts allow = 127. 192.168.0.

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

security = user
passdb backend = tdbsam

[www]
        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
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,877

Rep: Reputation: 350Reputation: 350Reputation: 350Reputation: 350
If I'm not mistaken, you need to make an addition to the [global] section of samba.conf. Something like this:
Code:
# 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
dolphin_oracle
Member
 
Registered: Dec 2013
Posts: 335

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
NotionCommotion
Member
 
Registered: Aug 2012
Posts: 565

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 http://www.samba.org/samba/docs/man/...tml#CREATEMASK,
Quote:
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?
 
  


Reply


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


All times are GMT -5. The time now is 09:16 AM.

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