DevOps · K8s · Volleyball · Travel  •  DevOps · K8s · Volleyball · Travel  •  DevOps · K8s · Volleyball · Travel
Explore NY Stream

How to install Samba 3.0.33 on Linux

— ny_wk

How to install Samba 3.0.33 on Linux

To install Samba on a Red Hat-based Linux server, install the samba, samba-common, and samba-client packages, edit /etc/samba/smb.conf to define your shares, enable the service at boot, and create Samba accounts with smbpasswd -a. This guide walks through the full process on legacy RHEL/CentOS 5 (where Samba 3.0.33 shipped) and gives the exact modern equivalent for current systems, so you can stand up reliable Windows-to-Linux file sharing whether you are maintaining an old box or building a new one.

Samba is the open-source implementation of the SMB/CIFS networking protocol. It lets a Linux machine share folders and printers that Windows, macOS, and other Linux clients can mount as native network drives. The steps below mirror a real production runbook: install the packages, edit smb.conf, manage the Samba user database, set the service to start automatically, and verify everything works before you hand it off.

Before You Begin: The Samba 3.0.33 Version Note

The original deployment target here is Samba 3.0.33 on RHEL/CentOS 5 (package samba-3.0.33-3.14.el5.x86_64.rpm). That release is long past end-of-life: RHEL 5 reached the end of extended support, and Samba 3.0.x has not received security patches for many years. Do not expose a Samba 3.0.33 server to the public internet — it is vulnerable to several documented CVEs and only speaks the obsolete SMB1 dialect, which modern Windows clients disable by default.

If you are simply keeping an old, air-gapped system alive, the RHEL 5 steps are accurate and reproduced faithfully below. If you have any choice, install on a current OS instead — the package names and commands are nearly identical, and the modern equivalent is called out at every step.

What you need

  • Root access (or sudo) on the Linux server.
  • The installation packages. On RHEL/CentOS 5 they live on the install media under the /Server directory; on modern systems you install them straight from the repositories.
  • A folder you want to share and the list of users who should reach it.
  • Network access between the server and clients on TCP ports 445 (and legacy 137-139 for SMB1/NetBIOS).

Step 1: Install the Samba Packages

Samba is split into a few packages. The core daemon is samba, shared libraries live in samba-common, and the command-line tools clients use are in samba-client. On RHEL 5 the LDAP/Active Directory glue also pulls in perl-Convert-ASN1.

Legacy RHEL/CentOS 5 (Samba 3.0.33)

Mount the install media, change into /Server, and install the RPMs in dependency order. The -ivh flags mean install, verbose, and show a hash progress bar:

  1. Install the Perl ASN.1 dependency first:
    rpm -ivh perl-Convert-ASN1-0.20-1.1.noarch.rpm
  2. Install the shared common package:
    rpm -ivh samba-common-3.0.33-3.14.el5.x86_64.rpm
  3. Install the Samba server itself:
    rpm -ivh samba-3.0.33-3.14.el5.x86_64.rpm

Tip: install all three in a single command so RPM resolves the order for you: rpm -ivh perl-Convert-ASN1-*.rpm samba-common-*.rpm samba-*.rpm. Watch out for the dash — copy-pasted RPM commands often carry a Unicode en-dash that the shell rejects; always type a plain ASCII hyphen.

Modern RHEL/CentOS/Rocky/Alma (8, 9 and later)

Let the package manager fetch the current, patched Samba and its dependencies automatically:

  1. sudo dnf install samba samba-common samba-client

On Debian or Ubuntu the equivalent is sudo apt update && sudo apt install samba. Either way you get Samba 4.x, which supports the secure SMB2 and SMB3 dialects out of the box.

Step 2: Configure smb.conf for File Sharing

All of Samba's behaviour is driven by /etc/samba/smb.conf. The file has a global section that sets server-wide options, followed by one section per share. Back up the original before you touch it:

  1. cp /etc/samba/smb.conf /etc/samba/smb.conf.orig
  2. Open it in your editor:
    vi /etc/samba/smb.conf

Disable printer sharing you do not need

By default the stock file shares printers via CUPS and exposes a [printers] section. On a pure file server this is noise and a small attack surface. Comment out the printer-related lines by prefixing each with a semicolon (Samba's comment character is ; or #):

  • ; load printers = yes
  • ; cups options = raw
  • ;[printers]
  • ; comment = All Printers
  • ; path = /var/spool/samba
  • ; browseable = no
  • ; guest ok = no
  • ; writable = no
  • ; printable = yes

Understand the default home-folder share

Out of the box, the [homes] section means every user automatically gets their own private share pointing at their Linux home directory. That is convenient, but only the matching user can see and write to it. If you want a dedicated shared folder instead, add an explicit share section.

Add a custom share

Create the folder first, then describe it at the bottom of smb.conf:

  1. mkdir -p /srv/share
  2. chmod 2770 /srv/share (the leading 2 sets the setgid bit so new files inherit the group)
  3. Add this block to smb.conf:

[data]
   comment = Department share
   path = /srv/share
   valid users = bgates01
   writable = yes
   browseable = yes
   create mask = 0660
   directory mask = 0770

The key share options are summarised below.

OptionWhat it does
pathThe Linux directory exposed by the share.
valid usersWhich accounts may connect (space-separated; use @group for a group).
writable = yesAllows clients to create and modify files.
browseable = yesLists the share when a client browses the server.
create maskDefault permissions applied to newly created files.

Always validate the file after editing — testparm parses smb.conf and reports any syntax errors before you restart the service:

  1. testparm

Step 3: Enable Samba to Start Automatically

A file server is useless if it stops sharing after a reboot, so set the Samba daemon to launch at boot.

Legacy RHEL/CentOS 5 (SysV init)

On RHEL 5 the service is named smb and is managed with chkconfig. Enable it on the multi-user runlevels — runlevel 3 (text/multi-user) and runlevel 5 (graphical):

  1. chkconfig --level 35 smb on
  2. Start it now without rebooting:
    service smb start

Modern systems (systemd)

On RHEL 8/9, Rocky, Alma, Debian, and Ubuntu the daemons are smb and nmb (or smbd/nmbd on Debian). Enable and start them in one command:

  1. sudo systemctl enable --now smb nmb

The --now flag both enables the service at boot and starts it immediately.

Step 4: Create Samba User Accounts

This is the step that trips up the most people. Samba keeps its own password database, completely separate from the standard Linux /etc/passwd accounts. A user can have a valid Linux login and still be unable to reach a share until you add them to the Samba database. The Linux account must exist first, because Samba maps every share user to a real system UID.

Add a user

Make sure the Linux account exists (useradd bgates01 if not), then add the user to Samba. You will be prompted to set a Samba password — it can differ from the Linux password:

  1. smbpasswd -a bgates01

The -a means add. The general form is smbpasswd -a <username>.

Manage existing Samba accounts

The same tool handles the full account lifecycle:

CommandPurpose
smbpasswd -a <username>Add a user and set a Samba password.
smbpasswd -x <username>Delete the user from the Samba database.
smbpasswd -d <username>Disable the account (keeps it, blocks login).
smbpasswd -e <username>Re-enable a previously disabled account.

On modern Samba you can also use the newer pdbedit tool — pdbedit -L lists all Samba users, which is handy for auditing who has access.

Step 5: Open the Firewall and SELinux

The original RHEL 5 runbook stops at user creation, but on any real network two security layers will silently block clients if you skip them, so they are worth adding.

  • Firewall (modern): sudo firewall-cmd --permanent --add-service=samba then sudo firewall-cmd --reload.
  • SELinux: let Samba serve your custom directory with sudo setsebool -P samba_export_all_rw on for a quick lab, or set the proper context: sudo semanage fcontext -a -t samba_share_t "/srv/share(/.*)?" followed by sudo restorecon -Rv /srv/share.

On RHEL 5 the firewall is iptables and SELinux uses the same booleans, so the principle is identical even though the firewall command differs.

Common Pitfalls When You Install Samba on Linux

These are the issues that turn a five-minute job into a two-hour one:

  • Forgetting smbpasswd -a. The user has a Linux account, the share is defined, and they still get "access denied" — because they were never added to the Samba database.
  • SELinux blocking the share. Symptoms look exactly like a permissions problem; check with ausearch -m avc -ts recent or getenforce.
  • The Unicode dash in copied commands. Pasted RPM examples often use an en-dash (–) instead of a hyphen (-), producing a cryptic "invalid option" error. Retype the flags.
  • Linux file permissions overriding Samba. Even with writable = yes, the underlying folder must let the Linux user write. Match ownership and mode to the share's valid users.
  • SMB1 disabled on the client. A Samba 3.0.33 server only speaks SMB1, which modern Windows refuses by default. This is one more reason to move off the legacy stack.
  • Restarting the wrong service. On systemd you must restart smb, not the old smbd alias, after editing the config.

Verification: Confirm Samba Is Working

Never declare victory until you have tested from both the server and a client. Run these checks in order:

  1. Validate the config: testparm should print "Loaded services file OK".
  2. Confirm the daemon is up: systemctl status smb on modern systems, or service smb status on RHEL 5.
  3. List shares locally as a user: smbclient -L localhost -U bgates01 — you should see your [data] share listed.
  4. Connect to a share: smbclient //localhost/data -U bgates01, then run ls at the smb:\> prompt.
  5. Mount from Windows: in Explorer, open \\server-ip\data and authenticate with the Samba username and password.
  6. Mount from Linux: sudo mount -t cifs //server-ip/data /mnt -o username=bgates01.

If all six succeed, the server is correctly serving SMB to your network.

Roll Back: Removing Samba Cleanly

If you need to uninstall, remove the packages in reverse dependency order so RPM does not complain about packages still in use. On RHEL 5:

  1. rpm -e samba
  2. rpm -e samba-common
  3. rpm -e perl-Convert-ASN1

On modern systems a single command handles it: sudo dnf remove samba samba-common samba-client (or sudo apt remove --purge samba on Debian/Ubuntu). Before removing, stop the service and keep a copy of your smb.conf if you might rebuild later.

Key Takeaways

  • Install the samba, samba-common, and samba-client packages — via RPM on legacy RHEL 5, via dnf/apt on current systems.
  • Samba's password database is separate from Linux accounts: every share user needs smbpasswd -a <username> after the Linux account exists.
  • All sharing behaviour lives in /etc/samba/smb.conf; always run testparm before restarting the service.
  • Enable the daemon at boot with chkconfig --level 35 smb on (SysV) or systemctl enable --now smb nmb (systemd).
  • Samba 3.0.33 on RHEL 5 is end-of-life and SMB1-only — use it only on isolated legacy boxes, and prefer current Samba 4.x with SMB3 for anything new.

Frequently Asked Questions

Why can a user log into Linux but not access the Samba share?

Because Samba maintains its own account database that is independent of /etc/passwd. The Linux account lets them log into the OS, but they also need a matching Samba password created with smbpasswd -a <username>. Until that entry exists, every connection attempt returns access denied.

Where is the Samba configuration file and how do I test it?

The main configuration file is /etc/samba/smb.conf. After any change, run testparm to check the syntax; it loads the file, reports errors, and prints the effective settings. Only restart the service once testparm reports the file is OK.

Is it safe to run Samba 3.0.33 today?

No, not on an exposed network. Samba 3.0.x is unsupported, carries known CVEs, and only speaks the deprecated SMB1 dialect that modern Windows blocks by default. Keep it only on air-gapped legacy systems and migrate to a current Samba 4.x release with SMB2/SMB3 wherever possible.

What firewall ports does Samba need?

Modern SMB uses TCP port 445. Legacy SMB1/NetBIOS also uses UDP 137-138 and TCP 139. On a firewalld system, firewall-cmd --permanent --add-service=samba opens the right ports; on RHEL 5 you add the equivalent iptables rules.

For more hands-on Linux and sysadmin walkthroughs, subscribe to our YouTube channel @explorenystream.