Simple Samba Shares in Debian

From Thomas-Krenn-Wiki
Jump to navigation Jump to search



Please note that this article / this category refers either on older software / hardware components or is no longer maintained for other reasons.
This page is no longer updated and is purely for reference purposes still here in the archive available.

Here, we would like to quickly explain how you can create a simple Samba share on a Debian-based system. However, please note that we will not look at user permissions in detail here.

ALL USERS will have access to the share created, and can read, write and even delete.

Samba Installation

We install Samba with the following command:

 apt-get install samba

Any dependencies will be determined by the system. Please install them as well.

Backing up the Configuration File

A default configuration file will be created under

 /etc/samba/smb.conf

It would be best to back this file up, because the file is well commented and may be useful to you, if you want to review something.

 mv /etc/samba/smb.conf /etc/samba/smb.bak

Creating a New Configuration File

We will now create a new smb.conf file and create a simple share without any authentication, which provides access to everyone.

 nano /etc/samba/smb.conf

Enter the following configuration there:

 [global]
 workgroup = smb
 security = share
 share modes = yes
 
 [homes]
 comment = Home Directories
 browsable = no
 read only = no
 create mode = 0750
 
 [public]
 path = /media/storage/ 
 public = yes
 writable = yes
 comment = smb share
 printable = no
 guest ok = yes

With this configuration, you will get a share named

 public

which accesses a partition that has been mounted under:

 /media/storage

Please note that the /media/storage mount point must be given the 777 rights, so that everyone can write to it.

 chmod 777 /media/storage

Re-starting the Samba Service

To load this configuration, you will have to re-start Samba. The command for this is

 /etc/init.d/samba restart

All users should now have access to the created share.

Mounting the Share from a Linux Client

Starting with Ubuntu 10.10 and for all other up-to-date Debian based Linux distributions, the package cifs-utils should be installed instead of smbfs.

 apt-get install cifs-utils

Afterwards, the share can be mounted directly from the client:

 mount -t cifs //FILE-SERVER-IP-ADDRESS/public /local/mountpoint -o user=nobody

You will be asked for a password. Confirm the password by pressing the Enter key. The share should now be mounted and ready for reading and writing.

Mounting the Share from a Windows Client

Right-click on My Computer and select "Map Network Drive".

Enter the IP address and the name of the share:

 \\IP-DES-REMOTE-SERVERS\public

The network drive should now be connected.

Related articles

2U AMD Single-CPU SC825 Server
Icinga Graphs with PNP under Ubuntu 12.04 Precise
Installing VMware Tools under Debian