LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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, 01:28 PM   #1
NotionCommotion
Member
 
Registered: Aug 2012
Posts: 789

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, 02:30 PM   #2
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 356Reputation: 356Reputation: 356Reputation: 356
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, 02:43 PM   #3
dolphin_oracle
MX Linux
 
Registered: Dec 2013
Posts: 402

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, 05:36 AM   #4
NotionCommotion
Member
 
Registered: Aug 2012
Posts: 789

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



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 06:09 AM
[SOLVED] [SAMBA] How to track windows user access , create files /modify files on linux SMB efciem Linux - Server 2 05-16-2010 08:45 AM
permission settings umask / samba create mask eRJe Linux - Server 2 02-22-2010 06:08 AM
samba and file create permission noir911 Linux - Server 1 04-02-2009 08:17 AM
SAMBA ERROR: cannot create regular file `~/tux016.pdf': Permission denied mokele Linux - Software 5 02-07-2007 04:37 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:54 PM.

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
Open Source Consulting | Domain Registration