Samba Server Configuration in Debian

What is Samba?

Samba is a suite of Unix applications that speak the SMB (Server Message Block) protocol. Many operating systems, including Windows and OS/2, use SMB to perform client-server networking. By supporting this protocol, Samba allows Unix servers to get in on the action, communicating with the same networking protocol as Microsoft Windows products.

Samba Debian Package

This package contains all the components necessary to turn your Debian GNU/Linux box into a powerful file and printer server.

Currently, the Samba Debian packages consist of the following:

samba - LanManager-like file and printer server for Unix.
samba-common - Samba common files used by both the server and the client.
smbclient - LanManager-like simple client for Unix.
swat - Samba Web Administration Tool
samba-doc - Samba documentation.
smbfs - Mount and umount commands for the smbfs (kernels 2.2.x and above).
libpam-smbpass - pluggable authentication module for SMB password database
libsmbclient - Shared library that allows applications to talk to SMB servers
libsmbclient-dev - libsmbclient shared libraries
winbind: Service to resolve user and group information from Windows NT servers
python2.3-samba: Python bindings that allow access to various aspects of Samba

It is possible to install a subset of these packages depending on your particular needs. For example, to access other SMB servers you should only need the smbclient and samba-common packages.

Install Samba in Debian

#apt-get install samba samba-client

Now it will ask you some basic question about the samba configuration like

workgroup or domain name you want,other questions enter the correct information which one suits for your need.

Preparing directories and users

Create directories for Samba to use with Windows

#mkdir samba

Now we need to create users to access this directiory

#useradd ruchi

Now create a password for this user

#smbpasswd -a ruchi

configure samba configuration file

Samba configuration file located at /etc/samba/smb.conf

In this file main section is Global where you can define all parameters and the example as follows


workgroup = debian
netbios name = debianserver
server string = %h server (Samba %v)
log file = /var/log/samba/log.%m
max log size = 1000
syslog = 0

Now you need to configure the share directory(ex:-samba) for users below is the example.


valid users = ruchi
admin users = debain

If you want to check your configuration file is correct you need to run the following command


Now you need to restart the samba to take the new changes effect

#/etc/init.d/samba restart

If you want more configuration option check man page of smb.conf

Testing your samba configuration

You want to test your samba configuration for users ruchi run the following command

#smbclient -L //debianserver -U ruchi

Configuring the Windows workstation

authenticate each workstation

logon to the Windows workstation as any user with administrative priviliges

[Windows 2000] Start -> Settings -> Control Panel -> System -> Network Identification -> Properties -> Member of -> Domain -> type the domain name as specified in the 'workgroup' section of smb.conf -> ok

enter the root username and password for the Samba file server

if you simply wish to transfer existing users from a workstation, then if a user exists on the Samba file server and on the workstation, at this point you could log them into the Samba file server and their profile from the workstation would be copied to the Samba file server when they log out


Download samba form here

Samba documentation click here