Simple Samba Setup

Samba is a file and print sharing protocol more commonly found on the Windows platform. I have a single purpose for using Samba and here is a minimal guide for setting it up in openSUSE Leap or Tumbleweed.

Package Installation

You can either go into the package management

YaST > Software Manager

And search for samba and samba-client to see if they are installed

Or, in Terminal, search for them that they are installed

sudo zypper search samba

if you see a little in the first column next to samba and samba-client. They are indeed installed

If not, you can simply run this in terminal

sudo zypper install samba samba-client

Using the YaST > Software Management method is also a fine way of doing it too.

Activate Services

Terminal Method

My preferred method to activate and enable the services is the terminal, as it is just easy:

sudo systemctl start smb nmb

sudo systemctl enable smb nmb

The Graphical Interface Method

YaST > Services Manager

Search for nmb and smb, click the Start/Stop and Enable/Disable buttons for each service

Configure Firewall

The ports for Samba (the server) and Samba-Client (to only access other shares) must be opened in order to share files via the Samba protocol. Using Firewalld

Open YaST > Firewall Configuration Tool

For my system, I have defined my home network as the zone, “home”. Within that, I open up the ports for Samba and Samba-ClientFirewalld-Samba.png

Just selecting Samba would be all that is required as here are the affected ports when selecting those services:

Samba

  • 139 tcp
  • 445 tcp
  • 137 udp
  • 138 udp

Samba-Client

  • 137 udp
  • 138 udp

Since I configured the “Runtime” Firewall, I need to set it to “Permanent”. To ensure that at next restart of the service or reboot of the system, the configuration stays.

Firewalld-Runtime to Permanent

Initialization of Samba Server in YaST

 

You can probably just as well get a “magic config” file somewhere for YaST or go line by line with someone else’s configuration… OR you can use openSUSE’s automatic configuration method. This is my preferred method because I am sure that the engineers at SUSE and openSUSE have this all figured out.

YaST > Samba Server

You will be greeted with a dialog that wants you to put in your Workgroup. If you don’t care, just leave it at “WORKGROUP”

I want the Samba Server to start on boot, not manually so I ensured it was set as such on the “Start-Up” Tab

Samba-05-Startup.png

The only modification I made on the “Shares” Tab was to Allow Users to Share Their Directories

Samba-02.png

On the Identity Tab, I checked again my Workgroup name, ensured that this machine is not a domain controller, set the NetBIOS Hostname to the same as my Linux Hostname.

Samba-03.png

Add Samba Share Users

In order to allow users on your machine to share files, you need to add Samba Users. The easiest way I know how to do this is in terminal:

sudo smbpasswd -a cubiclenate

You will be prompted for a password. When you want to change it in the future. Simply run in terminal, under your own user account

smbpasswd

and follow the directions within the terminal.

Testing it out

It doesn’t appear that I am currently able to brows for Samba shares. I don’t know if there is some other level of paranoia on my network or on each server but I can type in the IP address of the machine or the NetBIOS Hostname and access the files on whichever machine with the permissions I set.

Samba-04

I consider this a success. I really only use Samba for scanning to a network folder from my HP OfficeJet Pro 8600 All-In-One. Outside of that, I don’t use Samba.

Final Thoughts

It’s good to be able to effectively deploy Samba in such a manner that you can integrate your Linux machine with other devices that speak Samba only, like an consumer grade All-in-One printer, I don’t have the option of nfs, ftp or sftp but thankfully, with a little tweaking, I can accommodate it.

I don’t consider myself an expert on using Samba in Linux but I can noodle around with it enough to make it work. If you have suggestions as to improve this, please let me know.

Further Reading

Firewalld on openSUSE Wiki

Samba on openSUSE Wiki

Advertisements