Install Samba in Slackware 13.1


If you want to share files between your Ubuntu and Windows computers, the best option is to use Samba file sharing. 

Samba is a free software re-implementation of SMB/CIFS networking protocol, originally developed by Australian Andrew Tridgell. As of version 3, Samba provides file and print services for various Microsoft Windows clients and can integrate with a Windows Server domain, either as a Primary Domain Controller (PDC) or as a domain member. It can also be part of an Active Directory domain.Samba runs on most Unix and Unix-like systems, such as Linux, Solaris, AIX and the BSD variants, including Apple’s Mac OS X Server (which was added to the Mac OS X client in version 10.2). 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 (Server Message Block), the name of the standard protocol used by the Microsoft Windows network file system.”

Downloading and Installing Samba

If you did not choose to install samba during your initial installation of Slackware, you will need to download the package from the Slackware website. Go here for the official Slackware 11 samba package. You will be presented with a list of mirrors. Select a mirror closest to you.

To check and see if you already have samba installed, run:

pirat9@foo:~$ less /var/log/packages/samba*

If you get a “No such file or directory” return, then you need to install the package linked above. Otherwise, skip this section completely.

Here are the steps I ran:

Download and install   with  this  command

# slapt-get -i samba



Now we have Samba installed.

Configuring Samba

By default, samba installs a directory in /etc/. So lets su to root and navigate to it.

pirat9@foo:~$ su –
root@foo:~# cd /etc/samba/

Inside this directory, we have a smb.conf-sample file. It is important to take a look at this file and read the comments provided. This will help you have a better understanding of the options you have available to you. I am going to give you a standard configuration file that I start with, and I encourage you to build on it.

To use my configuration file as a base, run:

root@foo:/etc/samba$ touch /etc/samba/smb.conf
root@foo:/etc/samba$ vim /etc/samba/smb.conf

Then you’ll want to copy/paste the following:

workgroup = Unixmen
server string = foo
security = user
load printers = yes
log file = /var/log/samba.%m
max log size = 50
socket options = TCP_NODELAY

comment = Home Directory
path = /home/pirat9/
valid users = pirat9
writable = yes

Line by line description:
The [global] section contains global configuration parameters not specific to any directory shared.

workgroup = Unixmen is defining what the NT-Domain-Name or Workgroup-Name is. You will want to change Unixmen to whatever you have set in Windows as your workgroup.

server string = foo defines the description of the Linux machine. This is equivalent to the Windows description field. Change this to something that describes your Linux computer.
security = user is setting the security mode to user level security. We will discuss how to create users for samba later. See the samba documentation for other security modes available.

load printers = yes tells samba to automatically load the printer list.

log file = /var/log/samba.%m defines where you want samba to log to. The %m tells samba to keep a separate log file for each machine on the network.

max log size = 50 defines the maximum size of the log files, in (Kb).

socket options = TCP_NODELAY this setting supposedly helps samba perform better. See the official samba documentation for more details.

The [home] section is essentially a share definition. Everything residing under [home] is specific to the share, and no other shares.

comment = Home Directory defines what the shares description will be.

path = /home/pirat9/ is the direct path for the share. Change this to reflect the directory you want to share.

valid users = pirat9 is telling samba to only allow the user pirat9 access to this share. Change this to a user that exists on your machine. See /etc/passwd for a list of existing users.

writable = yes tells samba to allow the valid users to write to this shared directory.

Now that you have a simple smb.conf file to work from, save it.

Setting up Samba users with smbpasswd:

Since we chose to use the security mode “users” in our samba configuration file, we need to set up the users. To do so, run:

pirat9@foo:~$ smbpasswd -a pirat9
New SMB Password:
Retype new SMB Password:

Remember, you can only add samba users via smbpasswd if they already exists as real users on the machine. To see the real users, take a look at your /etc/passwd file. Also note, for all users you add in your smb.conf to the valid users line, you must create a password for them using smbpasswd.

Running Samba

Execute the rc.samba file like so:

pirat9@foo:~$ chmod 755 /etc/rc.d/rc.samba

pirat9@foo:~$ /etc/rc.d/rc.samba start
Starting Samba: /usr/sbin/smbd -D
/usr/sbin/nmbd -D

Now you should be all set up to view your Linux share from Windows. Go to your Windows machine, select Start > Run … and type or whatever your Linux machines local IP is. After successfully connecting, you should first see a prompt for a user name and password. Enter in the user name added via smbpasswd and you should be granted access to your share.


source  :