You are on page 1of 19

Samba Server

What Samba is All About


It is an open source software suit in Linux that provides file,
network share and print services to windows and Linux
clients

SAMBA uses SMB (Session Message Block) and


CIFS (the Common Internet File System) to provide its
services. It enables windows and Linux /UNIX networks to
communicate and share.
Though the use of configuration files and POSIX
permission, SAMBA allows you to share files on a Linux or
windows network with access control and user and group
permissions.
2
Samba
What Samba Does

Samba consists of two key programs, plus a bunch of other


stuff.

The two key programs are smbd and nmbd.


Their job is to implement the four basic modern-day
CIFS services, which are:
• File & print services
• Authentication and Authorization
• Name resolution
• Service announcement (browsing)

Samba
Install and configure samba
Configure the mirror
• Directory
/etc/apt/sources.list

• update the mirror


apt-get update

Or you can install from CD-ROM without configuring the


mirror. Check the samba software is installed on the server
machine
• apt-cache policy samba
Install the samba
• apt-get install samba
4

Samba
Samba Server Types and the smb.conf
File
Samba server can be configured in different ways
• Anonymous access
• Samba file with user access with the homes section
• Samba file with user access and share (force group and force
user )

All modifications to Samba are done in

• /etc/samba/smb.conf

5
Samba
Type 1
configuring samba to allow
anonymous access to the share
Configure the smb.conf files
• Sudo vi /etc/samba/smb.conf
[global] [name for the share]
workgroup = WORKGROUP comment = Networking Department
security = share files path = Path of the shared file
map to guest = Bad User
(eg. path = /home/abel/lectureNotes)
show add printer wizard = No
wins support = yes read only = No
guest ok = Yes

Samba
To check the samba config file is correct or not type
• testparm –s

Restart the samba


• /etc/init.d/samba restart

Check first your server and the client must be on the same network
by pinging the server from the client machine using sever name or IP
address
ping servername or Ping IP address

Samba
To access the shared file from windows
client

start → run
then type the servername (ip address) of the server and share name

Samba
Type 2
Samba file with user access with the
homes section
Assume
Server name : cci
Group name: ITDept

Creation of user
Useradd -m –G groupName UserName
-m is creating a user home directory (/home/userName)
-G put UserName in the users group

Example
Useradd -m –G ITDept Alex
-m is creating a user home directory (/home/Alex)
-G put Alex in the users group (in this case the group is ITDept) 9

Samba
Creating password
Create password for the user Alex
Passwd Alex
and retype the passwd
Create a samba password for user Alex
smbpasswd –a Alex
and retype the password
The user will be added to samba user list

10

Samba
Samba config file
Create password for the user Alex
sudo Vi /etc/samba/smb.conf

# Global parameters [homes]


[Global] Comment = Home Directories
Workgroup = WORKGROUP valid users = @ITDept
security = user read only = No
browseable = No

11

Samba
Type 3
Samba file with user access and share
(force group and force user )
Assume our
To Create users group to be used for the
share Server name : cci
groupadd GC Group name: GC
To add user chala in group users Users: chala , sami,
Useradd -m –G GC chala dawit
Create password for the user chala Share: Project
passwd chala Guideline
and retype the passwd
Create a samba password for user chala
smbpasswd –a chala
and retype the password
- The user chala will be added to samba user list
12

Samba
Cont’d
To add more users in the created group
adduser NameOfUser NameOfGroup
Example
adduser sami GC

Use the id command to check group and user id


id sami

To see the users in GC group


Cat /etc/group
13

Samba
Configure the smb.conf
sudo vi /etc/samba/smb.conf

[global]
[Project Guideline]
workgroup = WORKGROUP comment = Guideline for final year project
security = user path = /home/user/Desktop/Guidlines
read only = No
[homes] valid users = @GC
Comment = Home Directories force user = chala, sami
valid users = @GC read only force group = GC
= No
browseable = No
14

Samba
Example: Map network drive for user
chala

1. Open my computer → click tools from the menu bar Map Network Drive...
2. From the dropped down menu select Drive Letter eg G, H, Z
3. In the box labeled “Folder”, type
\\servername(cci) \share name(project Guideline)
4. Click finish
5. Then you will get the username and password dialog box
6. Type user name and password for the user chala

Then you will get the network drive of Chala and you can put your file in the
chala’s network drive.

So that the system administrator can set access control and user and group
permissions according to the role of the user in /etc/samba/smb.conf share setup.
Samba 15

You might also like