Samba (the Linux implementation of the Server Message Block protocol) is an Open Source suite that provides seamless file and print services to SMB/CIFS clients. Basically, it allows both Linux and Windows users to use each other's SMB file shares as if they were a hard disk on their own machine. A mapped network drive (Windows) or a mounted smb share (Linux) can look, feel and act like your own disk space, but it's really a disk space on some other computer somewhere on the network. Samba also provides print services for various Windows clients and can also integrate with a Windows Server domain, either as a Primary Domain Controller (PDC) or as a Domain Member. Moreover, it can be part of an Active Directory domain. This article will explain how to install and configure Samba on Slackware 11.0 but it should work with older Slackware builds as well.
Download and install
- Fist of all, you should check if Samba has been selected during Slackware installation. To check if you already have Samba installed, run:
If you get a "No such file or directory" error, proceed to installing Samba, otherwise skip this section completely.
- At this time, the latest Slackware version of Samba is 3.0.23c. Click HERE to visit the Samba package info and download for Slackware-latest.
- Choose the closest mirror to you and copy the download link.
You now have Samba installed.
- To configure Samba, you will first have to be logged in as root. To switch to root user, go into a terminal and run:
(Enter root password)
Samba can be configured through its smb.conf file. By default, this file resides in /etc/samba. However, the first time you install Samba, that file *should* be called smb.conf-sample. The recommended way to get Samba up and running is by creating a new smb.conf file with the basic directives and later on, add new directives to suit your system and network configuration. So follow these steps:
- Move an eventual smb.conf file:
(it's ok if you get a no such file or directory error)
- Create a new file and open it up with your favorite editor (i'll use nano)
- Copy/paste the following directives to the newly created Samba config file:
workgroup = WORKGROUP
server string = foo
security = user
load printers = yes
log file = /var/log/samba.%m
max log size = 50
socket options = TCP_NODELAY
comment = My Home Directory
path = /home/someuser
valid users = someuser
writable = yes
workgroup - Enter here the NT Domain Name or Workgroup Name currently set for your network.
server string - Used for showing a description related to the Linux server.
security - Sets the Authentication Mode to user. You will gain access to Linux shares only when using a username and password. (We'll set these later).
load printers - Set this to No if there are no printers connected to the Linux server.
log files - Defines the file that will store Samba events, alerts and errors.
max log size - Sets the maximum size for the log file, in Kb.
socket options - Specifies the options set on the client socket. The TCP_NODELAY option was reported as the option that makes the biggest difference in performance for most networks.
comment - Used for showing a description related to the user share.
path - Defines the shared directory.
valid users - Sets the users (see /etc/passwd for a valid user list) allowed to access this share.
writable - Allows valid users to write to this shared directory.
- Because the Authentication Mode was set to User, you'll now have to create a new samba user:
(Enter the new password for this user)
The 'someuser' must be the same user as the one set in the valid users directive in smb.conf. Moreover, this user must also be a valid Linux user (has to be listed in /etc/passwd).
Run and load at boot
Samba can be started using the RC file that came with the Samba package. This RC file is called rc.samba and should reside in /etc/rc.d. However, this file *COULD* be called rc.samba.new or it could not be set as executable. To make sure everything is set up correctly and to start Samba, run the commands:
chmod 755 /etc/rc.samba
Test the installation
First, make sure that ports 139 and 445 (both TCP and UDP) aren't blocked by the Linux firewall. Then go to a computer in the network and open a file browser. In the address bar, write the following address (replace 10.10.0.1 with the correct Linux LAN IP):
You should be prompted by a username and a password. Enter the ones configured using smbpasswd and you should be granted access to the Samba share.