Introduction to Samba

Beginners Tutorial Track

Mike Maki

mmaki@adelphia.net

Intended Audience

This session is intended for those users unfamiliar with Samba but want some experience and a platform for experimenting with Samba.

What is Samba?

From samba.org...Samba is an Open Source/Free Software suite that provides seamless file and print services to SMB/CIFS clients. Allows for interoperability between Linux/Unix servers and Windows-based clients.

Simplified...File and print serving for Windows from Linux/Unix

“Opening Windows to a wider world”

What do we need?

Almost any *NIX OS will work with Samba.

We'll use a Debian installation from Knoppix

Knoppix 3.7 (knoppix.net)

Knoppix

Current version of Knoppix is 3.7.

700MB iso image – burn to CD.

Designed to be a “live” Linux distribution, but easily installed to hard disk. Need about 3.5GB free space.

Installing Knoppix

Boot the knoppix cd. Get a shell prompt and start the knoppix install to hard disk.

$ sudo knoppix-installer

Once installed reboot...

Knoppix Desktop

New Knoppix Install

Once you have booted to your new installation:

Add yourself to sudoers.

$ sudo visudo

username ALL=NOPASSWD: (ALL)

apt-get

$ sudo apt-get update

Resynchronizes the package index files from their sources.

$ sudo apt-get install samba

Updates samba to 3.0.10-1

(Current Samba Stable is 3.0.11)

smb.conf

The heart of Samba

$ sudo vi /etc/samba/smb.conf

to allow writing to users home directories by changing:

read only = yes to

read only = no

and comment out

# include = /etc/samba/dhcp

smb.conf

Literally hundreds of configurable items in smb.conf.

Can be a small as

[global]

workgroup = workgroup

netbios name = netname

[share1]

path = /shared_directory

Checking Samba

$ testparm

Checks smb.conf configuration file for internal correctness

testparm

$ testparm

Load smb config files from

/etc/samba/smb.conf

Processing section "[homes]"

Processing section "[print$]"

Processing section "[printers]"

Loaded services file OK.

Server role: ROLE_STANDALONE

Press enter to see a dump of your service definitions

testparm continued

...

[homes]

comment = Home Directories

read only = No

create mask = 0700

directory mask = 0700

browseable = No

...

smbpasswd

Has several different functions. We'll use it to create user name and password for authentication to Samba.

Any Samba users must also have a valid UNIX account.

smbpasswd

$ sudo smbpasswd -a mmaki

New SMB password:

Retype new SMB password:

Starting Samba

Start from init script:

$ sudo /etc/init.d/samba start

Starting Samba daemons: nmbd smbd

Which is the same as starting each daemon.

$ sudo nmbd -D

$ sudo smbd -D

Samba Processes

Check the samba processes with

$ ps ax | grep mbd

5948 ? Ss 0:00 nmbd -D

5957 ? Ss 0:00 smbd -D

5958 ? S 0:00 smbd -D

Checking Windows Clients

After Samba is up and running the best way to check if it's working is from a Windows client.

Browse Network Neighborhood/My Network Places

Checking Windows Clients

DOS command

C:\> net view /DOMAIN:workgroup

Server Name	Remark

-------------------------------

KNOPPIX knoppix server...

smbclient

To check Samba from localhost use smbclient.

$ smbclient -L localhost -N

Anonymous login successful

Domain=[WORKGROUP] OS=[Unix]Server=[Samba...

Sharename Type Comment

--------- ---- -------

print$ Disk Printer Drivers

IPC$ IPC IPC Service

ADMIN$ IPC IPC Service

smbclient

Check password authentication:

$ smbclient -L localhost -U username

password:

If successful you should see same results in addtion to your private share.

winbind

winbind is a component of the Samba suite of programs that solves the unified logon problem.

You do not need to add an account to every *NIX server serving samba. Also allows the use of NT Domain permissions to be used and applied from NT User Manager.

Review

Boot Knoppix

knoppix-installer

visudo

apt-get update

apt-get install samba

vi /etc/samba/smb.conf

testparm

smbpasswd -a username

/etc/init.d/samba start

smbclient -L localhost -U username

swat

swat allows a Samba administrator to configure the smb.conf file via a Web browser. I personally don't recommend it, but you may like it!

$ sudo apt-get install swat samba.doc

Make sure swat 901/tcp exists and is uncommented in /etc/services

Starting swat

Edit /etc/inetd.conf, uncomment the swat entry (usually at the end of the file), and then restart inetd.

$ sudo /etc/init.d/inetd restart

Open a browser and point it to http://localhost:901/

Finished!

In less than an hour with the right tools you can build a functional Samba server.

Knoppix provides an easy and efficient tool for experimenting not only with Samba but many of the other tools included in the image.

2005-01-28T17:49:29