samba: permission for sharing public and private folder
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
For the [public], make sure that the Linux file permissions are set so the directory is world readable. In fact, I would set the directory permissions like this:
Code:
drwxrwxr-x root staff /home/samba/public
Then modify the [public] share so it looks like this:
Code:
[public]
comment = Public Stuff
path = /home/samba/public
read only = Yes
write list = @staff
guest ok = Yes
create mask = 0664
directory mask = 0775
vfs objects = /usr/lib/samba/vfs/audit.so
This will make the files readable to everyone and writable only by "staff". The "create mask" and "directory mask" ensure new and modified files and directories retain their correct permissions.
For the [sharing] share, create a new group for all users that will have access to this file share. It will not be their primary group. Set the permissions on the directory like this:
Code:
drwxrwx--- root mygroup /home/samba/sharing
Then modify the [sharing] share so it looks like this:
Code:
[sharing]
comment = people stuff
path = /home/samba/sharing
valid users = @mygroup
public = no
writable = yes
printable = no
create mask = 0660
directory mask = 0770
force group = mygroup
This share will now only be accessable to members of "mygroup". The "create mask" and "directory mask" ensure new and modified files and directories retain their correct permissions, and the "force group" causes all file read/writes to be the group "mygroup" regardless of what the user's primary group is, ensuring that all members can read/write/modify files.
1. what is the difference between create mask and directory mask?
2. I can send messages to Win XP client but not to Linux client running samba. I got this error :
what is the difference between create mask and directory mask?
The create mask sets the permissions that files will be created with by an SMB client. Directory mask sets the permissions that directories will be created with.
The is a wealth of documentation on the Samba web site, including free PDF/HTLM copies of Samba-3 HOWTO and Samba-3 By Example from the Bruce Perens Open Source Series. I highly recommend Samba-3 By Example as a tutorial of how to do things with Samba.
For the [public], make sure that the Linux file permissions are set so the directory is world readable. In fact, I would set the directory permissions like this:
Code:
drwxrwxr-x root staff /home/samba/public
Then modify the [public] share so it looks like this:
Code:
[public]
comment = Public Stuff
path = /home/samba/public
read only = Yes
write list = @staff
guest ok = Yes
create mask = 0664
directory mask = 0775
vfs objects = /usr/lib/samba/vfs/audit.so
This will make the files readable to everyone and writable only by "staff". The "create mask" and "directory mask" ensure new and modified files and directories retain their correct permissions.
For the [sharing] share, create a new group for all users that will have access to this file share. It will not be their primary group. Set the permissions on the directory like this:
Code:
drwxrwx--- root mygroup /home/samba/sharing
Then modify the [sharing] share so it looks like this:
Code:
[sharing]
comment = people stuff
path = /home/samba/sharing
valid users = @mygroup
public = no
writable = yes
printable = no
create mask = 0660
directory mask = 0770
force group = mygroup
This share will now only be accessable to members of "mygroup". The "create mask" and "directory mask" ensure new and modified files and directories retain their correct permissions, and the "force group" causes all file read/writes to be the group "mygroup" regardless of what the user's primary group is, ensuring that all members can read/write/modify files.
Enjoy.
Hi Centauricw,
If let's say a few of my users - user1, user2 ,and user3 request for the READ permissions for the above folder; What should i do?
For the [public], make sure that the Linux file permissions are set so the directory is world readable. In fact, I would set the directory permissions like this:
Code:
drwxrwxr-x root staff /home/samba/public
Then modify the [public] share so it looks like this:
Code:
[public]
comment = Public Stuff
path = /home/samba/public
read only = Yes
write list = @staff
guest ok = Yes
create mask = 0664
directory mask = 0775
vfs objects = /usr/lib/samba/vfs/audit.so
This will make the files readable to everyone and writable only by "staff". The "create mask" and "directory mask" ensure new and modified files and directories retain their correct permissions.
For the [sharing] share, create a new group for all users that will have access to this file share. It will not be their primary group. Set the permissions on the directory like this:
Code:
drwxrwx--- root mygroup /home/samba/sharing
Then modify the [sharing] share so it looks like this:
Code:
[sharing]
comment = people stuff
path = /home/samba/sharing
valid users = @mygroup
public = no
writable = yes
printable = no
create mask = 0660
directory mask = 0770
force group = mygroup
This share will now only be accessable to members of "mygroup". The "create mask" and "directory mask" ensure new and modified files and directories retain their correct permissions, and the "force group" causes all file read/writes to be the group "mygroup" regardless of what the user's primary group is, ensuring that all members can read/write/modify files.
Enjoy.
Hi,
I followed the [public] share creation in above and only the alternation I did is introduce the "create mask 0674" - as I want staff group to have all the access (specially reading) but the files are creating with 664 permissoin. ???
[public]
comment = Public Stuff
path = /home/samba/public
read only = Yes
write list = @staff
guest ok = Yes
create mask = 0674
directory mask = 0775
rwxrwxrw- 2 root staff 4,096 Feb 2 11:01 public
see in ls -al /home/samba/public
-rw-rw-r-- 1 pppp pppp 222,170 Dec 8 13:24 net-snmp-perlmods-5.4.2.1-1.f9
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.