What is meaning of 755 permissions in Samba Share

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:

Permission    Action      chmod option
======================================
read          (view)      r or 4
write         (edit)      w or 2
execute       (execute)   x or 1

There are also three types of user restrictions:

User    ls output
==================
owner   -rwx------
group   ----rwx---
other   -------rwx

Folder/Directory Permissions

Permission    Action                               chmod option
===============================================================
read          (view contents: i.e., ls command)      r or 4
write         (create or remove files from dir)      w or 2
execute       (cd into directory)                    x or 1

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:

Symbolic Notation    Octal Notation    English
============================================================
----------            0000               no permissions
---x--x--x            0111               execute
--w--w--w-            0222               write
--wx-wx-wx            0333               write & execute
-r--r--r--            0444               read
-r-xr-xr-x            0555               read & execute
-rw-rw-rw-            0666               read & write
-rwxrwxrwx            0777               read. write & execute

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:

  • File Permissions
  • Unix/Linux Permissions
  • The file mask in Linux

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

  1. owner
  2. group
  3. other users

Now here is the "mathematics" about giving rights to your directories:

  • The common order is normally 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.)

000 no permissions

111 execute

222 write

333 write & execute

444 read

555 read & execute

666 read & write

777 read write & execute

Now here we go

7 is category "owner"

5 is category "group"

5 (last one) is category "others"

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.