Samba Server

1. What is Samba?
2. How do I install Samba?
3. How do I add/edit/delete network users when using authentication?
4. How do I share home folders with read only permission?
5. How do I share home folders with read/write permission?
6. How do I share a group folder with read only permission?
7. How do I share a group folder with read/write permission?
8. How do I share public folders with read only permission?
9. How do I share public folders with read/write permission?
1.

What is Samba?

Samba is a networking tool that enables Linux to participate in Windows networks. There are two parts to Samba, one being the server which shares out files and printers for other PC's to use, and the other being the client utilities, which allow Linux to access files and printers on other Windows/Samba PCs.

2.

How do I install Samba?

  1. Read How do I add Universe and Multiverse?

  2. Install the samba and smbfs packages with Synaptic (See How do I use Synaptic to install packages?)

    Networking > samba
    Cross Platform > smbfs

3.

How do I add/edit/delete network users when using authentication?

  1. Read How do I install Samba?

  2. To add network user

    1. Read How do I add/edit/delete users?

    2. smbpasswd -a system_username
      sudo gedit /etc/samba/smbusers

    3. Insert the following line into the new file

      system_username = "network username"
    4. Save the edited file (sample/smbusers_addeditdeletenetworkusers)

  3. To edit network user

    sudo smbpasswd -a system_username
  4. To delete network user

    sudo smbpasswd -x system_username
4.

How do I share home folders with read only permission?

  1. Read How do I install Samba?

  2. sudo cp /etc/samba/smb.conf /etc/samba/smb.conf_backup
    sudo gedit /etc/samba/smb.conf

  3. Find this line

    ...
        ; security = user
    ...
  4. Replace with the following lines

    security = user username map = /etc/samba/smbusers

    Alternatively replace with the following line to skip authentication

    security = share
  5. Save the edited file ( sample/smb.conf_sharehomefoldersreadsecurityuser)

  6. If using authentication read How do I add/edit/delete network users when using authentication?

  7. sudo testparm sudo /etc/init.d/samba restart

5.

How do I share home folders with read/write permission?

  1. Read How do I install Samba?

  2. sudo cp /etc/samba/smb.conf /etc/samba/smb.conf_backup
    sudo gedit /etc/samba/smb.conf

  3. Find this line

    ...
    ; security = user
    ...
  4. Replace with the following lines

    security = user 
    username map = /etc/samba/smbusers

    Alternatively replace with the following line to skip authentication

    security = share
  5. Find this section

    ...
        # By default, the home directories are exported read-only. Change next
        # parameter to 'yes' if you want to be able to write to them.
        writable = no
    ...
  6. Replace with the following lines

    # By default, the home directories are exported read-only. Change next
    # parameter to 'yes' if you want to be able to write to them.
    writable = yes
  7. Save the edited file (sample/smb.conf_sharehomefoldersreadwritesecurityuser)

  8. If using authentication read How do I add/edit/delete network users when using authentication?

  9. sudo testparm sudo /etc/init.d/samba restart

6.

How do I share a group folder with read only permission?

  1. Read How do I install Samba?

  2. sudo mkdir /home/group sudo chmod 777 /home/group/ 
    sudo cp /etc/samba/smb.conf /etc/samba/smb.conf_backup 
    sudo gedit /etc/samba/smb.conf

  3. Find this line

    ...
    ; security = user
    ...
  4. Replace with the following lines

    security = user 
    username map = /etc/samba/smbusers

    Alternatively replace with the following line to skip authentication

    security = share
  5. Append the following lines at the end of file

    [Group]
    comment = Group Folder
    path = /home/group
    public = yes
    writable = no
    valid users = system_username1 system_username2
    create mask = 0700
    directory mask = 0700
    force user = nobody
    force group = nogroup
  6. Save the edited file ( sample/smb.conf_sharegroupfoldersreadsecurityuser)

  7. If using authentication read How do I add/edit/delete network users when using authentication?

  8. sudo testparm sudo /etc/init.d/samba restart

7.

How do I share a group folder with read/write permission?

  1. Read How do I install Samba?

  2. sudo mkdir /home/group sudo chmod 777 /home/group/ 
    sudo cp /etc/samba/smb.conf /etc/samba/smb.conf_backup 
    sudo gedit /etc/samba/smb.conf

  3. Find this line

    ...
    ; security = user 
    ...
  4. Replace with the following lines

    security = user 
    username map = /etc/samba/smbusers

    Alternatively replace with the following line to skip authentication

    security = share
  5. Append the following lines at the end of file

    [Group]
        comment = Group Folder
        path = /home/group
        public = yes
        writable = yes
        valid users = system_username1 system_username2
        create mask = 0700
        directory mask = 0700
        force user = nobody
        force group = nogroup
  6. Save the edited file (sample/smb.conf_sharegroupfoldersreadwritesecurityuser)

  7. If using authentication read How do I add/edit/delete network users when using authentication?

  8. sudo testparm sudo /etc/init.d/samba restart

8.

How do I share public folders with read only permission?

  1. Read How do I install Samba?

  2. sudo mkdir /home/public
    sudo chmod 777 /home/public/
    sudo cp /etc/samba/smb.conf /etc/samba/smb.conf_backup 
    sudo gedit /etc/samba/smb.conf

  3. Find this line

    ... 
    ; security = user 
    ...
  4. Replace with the following lines

    security = user
    username map = /etc/samba/smbusers

    Alternatively replace with the following line to skip authentication

    security = share
  5. Append the following lines at the end of file

    [public]
        comment = Public Folder
        path = /home/public
        public = yes
        writable = no
        create mask = 0777
        directory mask = 0777
        force user = nobody
        force group = nogroup
  6. Save the edited file (sample/smb.conf_sharepublicfoldersreadsecurityuser)

  7. If using authentication read How do I add/edit/delete network users when using authentication?

  8. sudo testparm sudo /etc/init.d/samba restart

9.

How do I share public folders with read/write permission?

  1. Read How do I install Samba?

  2. sudo mkdir /home/public
    sudo chmod 777 /home/public/ 
    sudo cp /etc/samba/smb.conf /etc/samba/smb.conf_backup 
    sudo gedit /etc/samba/smb.conf

  3. Find this line

     
    
    security = user 
    
  4. Replace with the following lines to use authentication

     
    security = user 
    username map = /etc/samba/smbusers

    Alternatively replace with the following line to skip authentication

    security = share
                                
  5. Append the following lines at the end of file

    [public]
        comment = Public Folder 
        path = /home/public 
        public = yes 
        writable = yes
        create mask = 0777 
        directory mask = 0777 
        force user = nobody 
        force group = nogroup
  6. Save the edited file (sample/smb.conf_sharepublicfoldersreadwritesecurityuser)

  7. If using authentication read How do I add/edit/delete network users when using authentication?

  8. sudo testparm sudo /etc/init.d/samba restart