I am experimenting with Samba. I have a RAID drive mounted on /mnt/raiddrives
, and I want to share it on my network giving everyone full access to it. The Ubuntu guide says to do something like below in the smb.conf
file:
[share]
comment = Ubuntu File Server Share
path = /srv/samba/share
browsable = yes
guest ok = yes
read only = no
create mask = 0755
However, assuming the permissions are being set with the create mask
value, the 0755
means nothing to me. Searching on the web just brings up hundreds of people using different numbers with no clear explanation of what the numbers mean. So can someone tell me what the numbers mean and how I can figure out what number I want to use please?
This has nothing to do with Samba. This is related to file permissions.
There are three types of access restrictions:
There are also three types of user restrictions:
Folder/Directory Permissions
Numeric notation
Another method for representing Linux permissions is an octal notation as shown by
stat -c %a
. This notation consists of at least three digits. Each of the three rightmost digits represents a different component of the permissions: owner, group, and others.Each of these digits is the sum of its component bits in the binary numeral system:
Now, what does 755 mean?
7=
rwx
5=r-x
5=r-x
This means that the directory has the default permissions
-rwxr-xr-x
(represented in octal notation as 0755).Please read more about file permissions:
Please, forget about Samba and look at some simple thing here...I assume you don't need any technical language. Right?...well.
There are categories of users in your computer
Now here is the "mathematics" about giving rights to your directories:
XXXX
where the first"x" is ignored. The second "x" is the owner, the third "x" is the group and the fourth is the others.Here is the algorithm of giving permissions (ignoring the 0 on the left.)
Now here we go
Now, with 755 it means the owner which is root will read, write and execute in the directory. The group and others will only read and execute in the directory.
Play around with the algorithm.
You can also read this http://cs.brown.edu/cgc/net.secbook/se01/handouts/Ch03-FilesystemSecurity.pdf.