A few words of thanks would be greatly appreciated.

Installing a SAMBA server (Linux)

Installing a SAMBA server on the Mandrake Linux server will allow file sharing and printers on a network that consists of a mix of Linux and Windows PCs. The SAMBA has a client-server based architecture and consists of tools that can be used for developing services or test configurations. Before installing a SAMBA server, certain packages are required to be installed on the Mandrake Linux System. After the installation, configuring a SAMBA server can be done easily by making changes in the smb.conf configuration file. SAMBA Server Commands can be used to start, stop, restart or perform other functions with the SAMBA Server.

Installing and configuring a Samba server version 3.0.2a
Mandrake Linux version 10.0


Installation of the Mandrake 10.0 (Server)
Have a domain.


The Samba server is the preferred tool to install a LAN (Local Area Network) working with the SMB protocol (Server Message Block). It makes it easy to have both Linux and Windows PCs running on the same network. Samba is a useful system for sharing files and printers between Unix and Windows in a transparent and stable manner.

The Samba Architecture

Samba consists of a server and a client, as well as some tools to make practical services or test configuration. The server consists of two applications (called daemons):
  • smbd core server providing authentication services and access to resources
  • nmbd, to show the services offered by Samba

smbclient is a client for Linux providing an interface for transferring files and accessing printers. smbtar allows you to convert files to or from the TAR format under linux.

The communication protocol that allows communication between Windows and Linux is called SMB (Server Message Block). Developed by Microsoft in 1987, using a concept developed by IBM in 1985 (NetBIOS), this protocol relies on NetBEUI (and TCP / IP). The advantage of TCP / IP lies in the fact that it has been widely adopted. This means TCP / IP is already implemented on most operating systems, including Unix, Linux, AmigaOS, MacOS, and OS / 2.

Installation of required packages for samba server

First of all, ensure that the required packages are installed. If not, install them by typing MCC (Mandrake Control Center) into the terminal to log in as root (type su then the password for the root) go to Manager and then in Software Installer, select the three following packages:


Then Click on Install.

Starting Samba

After installation, the Samba server should normally be able to start by running the following command:

/ etc / rc.d / init.d / smb start       
Starting SMB services: [OK]
Starting NMB services: [OK]

The following command checks that both daemons are started correctly:
/etc/rc.d/init.d/smb status (or service smb status)

smbd (pid 1054) is running...      
nmbd (pid 1056) is running...

The commands

From the command root:
testparm /etc/samba/smb.conf
  • Test syntax writing file smb.conf

/etc/rc.d/init.d/smb stop
  • Stops the Samba services

/etc/rc.d/init.d/smb start
  • Starts the Samba Server

/etc/rc.d/init.d/smb restart
  • Starts Samba

  • Displays all active connections via Samba

Smb.conf file configuration

Samba configuration is done through a unique configuration file: smb.conf. This file is located in / etc / samba /

Note: After each modification of the smb.conf file with a text editor, save it and then type the command: / etc / rc.d / init.d / smb restart to restart the server saba and at the same time take into account changes in the smb.conf file.

This file describes the resources you wish to share, and the permissions / restrictions associated with them. The smb.conf file is divided according to topics, each referenced by a line containing the section name in brackets and comprising a set of parameters of the type attribute = value. A line beginning with a # is a comment line and a line beginning with ; is inactive.
There are 3 main sections:
  • [global]
    • General settings on the server
  • [homes]
    • Defines a shared directory
  • [printers]
    • Defines the shared printers on the server


Here is an example of [global]:


# Same group name as that on Windows (Network Neighbourhood)
workgroup = MSHOME

# Name under which the server will appear in Network Neighbourhood
= netbios samba server

# Which will appear in the detail section of the Neighbourhood network,% V
# Shows the number samba version
server string = Samba Server% v

# Passwords encrypted in transit
encrypt passwords = Yes
smb passwd file = / etc / samba / smbpasswd

# Storage locations in the event log
log file = / var / log / samba / log.% m

# Maximum size of the newspaper
max log size = 50

# No guest account (optional)
guest account = nobody

# Multi-user (optional)
Share modes = yes

# Location of the printcap (printer on the Linux server)
printcap = / etc / printcap

# Share all printers defined in printcap
printcap name = cups
load printers = yes
printing = cups
printer = @ adm adm

# Log file for Samba
log level = 1
log file = / var / log / samba / log.% m

# Security mode (user / share / server)
security = user

# Allow access to certain networks (the final point is important)
hosts allow = 192.168.1.

# You can allow all the machines of the network except
hosts allow = 192.168.1. EXCEPT

# Set the IP addresses of machines you want to prohibit access
# Samba server eg ALL, to prohibit everyone except the
# Machines authorized by <hosts allow>.
Hosts deny = ALL

# No dns proxy
dns proxy = no

# Leave this default fields
socket options = TCP_NODELAY SO_RCVBUF = 8192 SO_SNDBUF = 8192

# Activate the server function of time
time server = yes

# The login script bears the name of the group% g is the variable for the samba
# Primary group
logon script =% g.bat

# Allows the connection of users on the domain
domain logons = yes

# If you want the server is the master of the field
domain master = yes

# If the presence of multiple domain controllers, the
# Server that is a favorite
preferred master = yes

# In case of master server to save the election against other machines
# Windows
os level = 255
# Gives access to the netlogon directory that contains the startup scripts

# directory path
path = / home / netlogon

# Only specified users can use this directory
public = no

# We can not write in this directory
writable = no

# The directory does not appear in the tree
browseable = no

# list of users with root rights on that directory by trainer
admin users = John


[homes] allows you to define access to the directory for each user. Here is an example:

Comment # visible from the neighbourhood network
comment = Home Directories

# Display the resource for all
browseable = no

# Able to write to the resource
writable = yes


Sharing a directory
It is possible to define a personalized access to any directory on the machine by creating a section name that is given to the resource. This will contain among other things, a path parameter giving the path to the resource. This directory will be available for reading and writing on the station after the Windows user login.

Here is an example of a custom section:

# Comment visible from Network Neighbourhood
comment = /home/folder

# Path to the resource
# Beware of breaks!
path = /home/folder

# Display the resource for all
browseable = no
guest ok = yes

# Save user names to be validated, the procedure for
# Insert will be explained later
valid users = user_names

# Path to the resource
# Since user inserted to access must be no
public = no

# Users with the root directory on this
admin users = user_names

# Able to write to the resource
writable = yes


It is possible to share a CD-ROM (which should be previously installed), by creating such a section [cd-rom] as follows:

Comment # visible from the neighbourhood network
comment = CD-ROM

# Path to the reader
path = / mnt / cdrom

# Accessible to all
public = yes

# Unable to write to the resource
writable = no

create mask = 0750

Access to a resource Samba under linux

The Samba client (smbclient) can provide a command line interface to access Samba resources from a UNIX machine. smbclient allows you to verify the existence of a Samba server on the network and then lists the resources it shares using the command:
smbclient server_name_smb 

Once resources are identified, it is possible to access each of them using the command:
smbclient \\\server_name_smb\\ressource -U user_name      

Access a printer using the command:
smbclient \\\server_name_smb\\ressource -P       

Printing the file / usr / local / samba / lib / etc.conf is done using the command:
print /usr/local/samba/lib/etc.conf       

To display the print queue use:

To stop smbclient:

Note: To access the Network Neighbourhood in Linux, open Konqueror and type in the URL
bar: smb: /      

Creating Samba user accounts

To create a user on the Samba server under Linux Mandrake version 10 (server):

  • In the command line, type mcc log in as root (or via the "configure your computer")
  • From the Mandrake Control Centre, go to "System" then "Users and Groups" and go to "Add user"

In Command line:
  • Type: adduser UserName
  • Enter the password of the user in the following way (command line):
    • smbpasswd-a-User Name
  • In response:
    • New SMB password: Give the same password when adding user
    • Retype new SMB password
  • Create the same user with the same password on the Windows machine (Client):
    • Go to "Control Panel" and then "User accounts" to create a user with administrator rights
    • Repeat as many times as necessary

Sharing folders

There is the shared directory, which is common to all users. Beware, if you share a directory that is not in "Home", you will be denied access. The "home" directory, or one of its subdirectories, must contain the directory.

Error Messages

Problems: Network Not Found (Windows)       


Internal Error
Please send a full bug at http://kde.org
Unknown error condition in stat: Network is unreachable (Linux)

This type of error means that you are not connected to a network. Check the network cable, configuration and / etc / samba / smb.conf

If an error message such as:
Unable to connect to samba server       

is displayed, check the configuration file / etc / samba / smb.conf

A few words of thanks would be greatly appreciated.

Ask a question
CCM is a leading international tech website. Our content is written in collaboration with IT experts, under the direction of Jeff Pillou, founder of CCM.net. CCM reaches more than 50 million unique visitors per month and is available in 11 languages.


This document, titled "Installing a SAMBA server (Linux)," is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (https://ccm.net/).