Install Samba on Debian 9

HowtoForge offers excellent instructions on how to install applications, servers and tools on multiple Linux distributions. Instead of recreating what’s already done at HowtoForge, here’s the installation instructions to install Samba fileserver on Debian 9. It walks you through the installation, adding Samba shares, managing users, and accessing Samba from a Windows machine. Here’s the link.

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.

[movies]
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 10.10.10.107/movies. Log in as guest.

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

How To Connect Samba Shares on the Mac

Here’s a quick tutorial of how to connect to a Samba share on the Mac. Samba is a open-source software that provides interoperability between Unix/Linux and Windows systems. The Samba software allows for the sharing of files and printers between Windows, Unix, Linux and Mac OS X systems.

At home, I have NAS (network attached storage) with a 60GB drive running Samba. I use the NAS to store, share and backup files. I can access the NAS drive from my PC, Linux (Ubuntu) and now from the Mac. Here’s how:

  1. Open Finder.
  2. Press Command-K. A window will appear.
  3. Type smb://192.168.xxx.xxx. Use the IP address of your Samba share.
  4. Click connect.

If you’re Samba share is password protected, you will see a login screen, similar to the one below. Just enter your username and password, and press Connect.

Once connected, you should be able to browse the files on the Samba drive, just like any other file or folder on your Mac. The Samba drive will also show up on the left hand panel of the Finder under the Shared section. See snapshot below. Notice the Public folder is available for browsing.

There you have it. How to connect Samba shared drives to your Mac.