Installing a SAMBA server (Linux)

Last update on April 6, 2009 11:30 AM by hyts78
Published by hyts78

Installing a SAMBA server







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

Prerequisite


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

Introduction


The Samba server is the preferred tool to install a LAN (Local Area Network) working with the SMB protocol (Server Message Block). It is therefore possible to mix efficiently in the same network Linux and Windows PC with knowledge of the server software.
Its usefulness: SAMBA is a system for sharing files and printers between Unix and Windows in a transparent and stable.

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 (Samba servers display in the network neighborhood, ...)
Customer smbclient is a client for Linux provides an interface to transfer files, access printers
smbtar: to make a transfer to or from a tar file under linux
testparm checking the syntax of the smb.conf file, the configuration file of Samba
The communication protocol that allows communication between Windows and Linux 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 from the fact that it has been widely adopted. So TCP / IP is already implemented on most operating systems (Unix, Linux, AmigaOS, MacOS, OS / 2, ...). as follows:

Application
SMB
NetBios
TCP/IP
NetBeui
IPX/SPX
Network Drivers

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) in command line in 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 (all packages, alphabetical):

samba-client-3.0.2a-3mdk
samba-common-3.0.2a-3mdk
samba-server-3.0.2a-3mdk


Then Click on Install.

Starting Samba


After installation, the Samba server should normally be able to start (no file sharing or printer) by running the following command:

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


The following command to check 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

/smbstatus

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 the / etc / samba /
Note: Each modification of the smb.conf file with a text editor, save it and then typing the command: / etc / rc.d / init.d / smb restart (to restart the server samba 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), each 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:

• The section [global]
General settings on the server

• Section [homes]
define a shared directory

• The section [printers]
defines the shared printers on the server

‘’global’’ Section


Here is an example (the example is that Network R2D4) of [global]:
[global]

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

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

# Which will appear in the detail section of the neighborhood 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 192.168.1.10
hosts allow = 192.168.1. EXCEPT 192.168.1.10

# 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
[netlogon]

# 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’’ Section===
Sharing directory
Section [homes] allows to define access to the directory for each user. Here is an example section:

[HOME]
Comment # visible from the neighborhood network
comment = Home Directories

# Display the resource for all
browseable = no

# Able to write to the resource
writable = yes

‘’documents’’ Section


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:

[DOCUMENTS]
# Comment visible from Network Neighborhood
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

‘’Cdrom’’ Section


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

[CD-ROM]
Comment # visible from the neighborhood 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 firstly to verify the existence of a Samba server on the network and lists the resources it shares with the command:

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

A password should be asked to the user. Then, just send FTP commands to send / receive files or browse the directories of the resource.
Access to a printer by the command
smbclient \\\server_name_smb\\ressource -P

Printing the file / usr / local / samba / lib / etc.conf is by the command:

print /usr/local/samba/lib/etc.conf

the visualization of the print queue: queue

Stopping smbclient: exit
Note: To access the Network Neighborhood in Linux, open Konqueror and type in the URL bar: smb: /

Creating Samba user accounts and access to these users


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

Graphically


Command line type mcc log in as root (or via the "configure your computer"), we are in the Mandrake Control Center, then go to "System" then "Users and Groups" finally "add user. "

In Command line, type:


adduser UserName

Then enter the password of the user in the smbpasswd file in / etc / samba 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: idem

Create the same user with the same password on the Windows machine (Client):

Go to "Control Panel" and then in user account to create a user with rights "administrator"

Repeat as many times the previous operation that user to create.

Note: If users already exist on the Windows machine, only to recreate the Linux server and especially not rename a user, or it already exists or he must create it. Each user created in Windows, restart the station.

Sharing folders


There is the shared directory, which displays the directory according to the user logged and it is sharing a common directory.
Beware, if you share a directory that is not in the tree "Home" will be denied access, the directory "home" or one of its subdirectories must contain the directory for the best use of it .

Error Messages


The messages the following error may come from:

Problems: Network Not Found (Windows)
or:

Internal Error
Please send a full bug at http://kde.org
Unknown error condition in stat: Network is unreahable (Linux)
This type of error means that you are not connected to a network connection, check cable network, network configuration and / etc / samba / smb.conf to check.

If an error message such as:
Unable to connect to samba server
is displayed, in this case check the configuration file / etc / samba / smb.conf.
The Samba server appears in the field but displays the error message generated when clicked, in this case check the path of sharing any personal or in the smb.conf file.
Best answers for « Installing a SAMBA server (Linux) » in :
Install FreeNX server Show Install FreeNX server Instruction for installation Clients NX NX is a system that enables you to access your desktop from another computer over the internet. There exist different types of NX server: NX Server and 2X for...
Log in remotely with SSH (Linux) Show Log in remotely with SSH (Linux) The commands below are relevant only if you have an existing account on the PC you want to connect and that a SSH server is installed. When using Linux the syntax is quite simple as the client part is...
Install Dofus under Linux ShowDownload Dofus Decompress the file Use Dofus Online Install Dofus under Linux Download Dofus For example, if the directory link for the download is set as /home/USERNAME/dofus, you should make use of the command mkdir $HOME/dofus to...
Installing Azureus on linux ShowInstalling Azureus on linux Intro Installation Intro Azureus is a Java based BitTorrent client, it supportsI2P and Tor anonymous communication protocols. You can install Azureus from the official sources since the Bitorrent...
LAMP(Apache + MySQL + PHP) quick install on Linux ShowLAMP(Apache + MySQL + PHP) quick install on Linux Intro LAMP is the acronym for a free and open source software suite.usually used to define and run dynamic a web server infrastructure ,software development and establish a software...
Intranet - Installing a mail server ShowIntroduction to installation The most commonly used e-mail server in Linux is Sendmail; however, as it is very hard to configure, we will use Qmail, an alternative e-mail server, instead. Qmail is made up of a group of programs that work with...
Intranet - Installing a DNS ShowPackages needed for installation A DNS (domain name server) is a server that links names to the IP addresses of computers on a network. In order to set up such a server, it is necessary to install bind and named. They can be downloaded as RPM files...
Intranet - Installing the Linux distribution Mandrake ShowIntroduction to installation The server can work with any Linux distribution, but we have chosen to use the distribution Mandrake, which has the advantage of being simple to install, and includes a multitude of pre-installed applications. You can...