Share Files Using Samba

One way of sharing files within your network is to use a Samba server. If you are a Linux user, whether it’s Ubuntu, Debian, Fedora, or any other distro, you can share folders with Windows and Mac users by simply installing a Samba server. This article will guide you with the installation of Samba.

Samba is a free software using the SMB/CIFS networking protocol, which was originally developed by Andrew Tridgell. Samba provides file and print services for various Microsoft Windows clients, and a Windows Server domain either as a Primary Domain Controller or as a domain member.

Samba runs on most Unix and Unix-like systems, such as GNU/Linux, Solaris, AIX and the BSD variants, including Apple’s Mac OS X Server. Samba is standard on nearly all distributions of Linux and is commonly included as a basic system service on other Unix-based operating systems as well.

Samba is released under the GNU General Public License. The name Samba comes from SMB or Server Message Block, the name of the standard protocol used by the Microsoft Windows network file system.

Install Samba

Setting up Samba server is very easy. For example, you want to share files, movies, etc. with others on your network. To install Samba, open your Terminal and type the following:

sudo apt-get install samba

Edit Samba Config File

Edit the /etc/samba/smb.conf file. From the Terminal type:

sudo gedit /etc/samba/smb.conf

Change the workgroup to your Windows workgroup. Mine is HOME. It’s important that you use the same workgroup with your other Windows machines. In addition, you also need to uncomment ‘security = user’ by removing the semicolon at the start of the line.

workgroup = HOME
security = user

Create A Share

In the example below, I will share a folder called ‘movies.’ You can name your share to anything you want. Adjust your path. Make your share browsable. Let guests have access to it. Make it writable. Finally, mask your share with 0755.

comment = Movies
path = /home/ulysses/movies
browsable = yes
guest ok = yes
read only = no
create mask = 0755

Create The Share Directory

You can now create your directory and change the ownership to nobody.nogroup. From the Terminal type:

sudo mkdir -p /srv/samba/movies
sudo chown nobody.nogroup /srv/samba/movies/

Restart Samba

Restart the Samba services. From the Terminal type:

sudo restart smbd
sudo restart nmbd

Access From Other Computers

You can now access your Samba share from other computers. In Windows can go to My Network Places > View workgroup computers. Look for the computer and share. The Workgroup needs to be the same with your other Windows systems.

On the Mac, open Finder > Go > Connect to Server. I used the Samba server IP address to access it from the Mac. In this case, my Samba share is Log in as guest.

As you noticed, installing a Samba server is quite easy.