Monthly Archives: July 2010

UbuntuVideoCast: Windows File-Shareing with SAMBA

Share Button

Samba is the SMB (Server Message Block) and CIFS (Common Internet File System) implementation which makes it possible to share files with windows platforms and even makes is possible to create a PDC (Primary Domain Controller). The PDC maintains Users, Groups, Permissions, Printers and File-Shares. Here is a explanation of what SMB and CIFS is, I borrowed it from Microsofts website:
The Server Message Block (SMB) Protocol is a network file sharing protocol, and as implemented in Microsoft Windows is known as Microsoft SMB Protocol. The set of message packets that defines a particular version of the protocol is called a dialect. The Common Internet File System (CIFS) Protocol is a dialect of SMB. Both SMB and CIFS are also available on VMS, several versions of Unix, and other operating systems. The technical reference to CIFS is available from Microsoft Corporation at Common Internet File System (CIFS) File Access Protocol. Although its main purpose is file sharing, additional Microsoft SMB Protocol functionality includes the following:

  • Dialect negotiation
  • Determining other Microsoft SMB Protocol servers on the network, or network browsing
  • Printing over a network
  • File, directory, and share access authentication
  • File and record locking
  • File and directory change notification
  • Extended file attribute handling
  • Unicode support
  • Opportunistic locks

In the OSI networking model, Microsoft SMB Protocol is most often used as an Application layer or a Presentation layer protocol, and it relies on lower-level protocols for transport. The transport layer protocol that Microsoft SMB Protocol is most often used with is NetBIOS over TCP/IP (NBT). However, Microsoft SMB Protocol can also be used without a separate transport protocol—the Microsoft SMB Protocol/NBT combination is generally used for backward compatibility. The Microsoft SMB Protocol is a client-server implementation and consists of a set of data packets, each containing a request sent by the client or a response sent by the server. These packets can be broadly classified as follows:

  • Session control packets—Establishes and discontinues a connection to shared server resources.
  • File access packets—Accesses and manipulates files and directories on the remote server.
  • General message packets—Sends data to print queues, mailslots, and named pipes, and provides data about the status of print queues.

Some message packets may be grouped and sent in one transmission to reduce response latency and increase network bandwidth. This is called “batching.” The Microsoft SMB Protocol Packet Exchange Scenario section describes an example of a Microsoft SMB Protocol session that uses packet batching.

In order to install Samba you can use apt-get, aptitude or tasksel. After the installation the smbd and nmbd services get started and will start automatically every time the systems boots. On Ubuntu the following directories are good to know.

This directory contains all of the main configuration files used by Samba, including local password files.

The smb.conf file is the core configuration file for Samba and is used to define file-shares and global settings for Samba itself.

This is Samba’s init script to start, stop, restart, reload the services.

This tool will be used to add users to the Samba Users Database but a linux user need to exist prior to this task otherwise you receive an error. Here are some switches that can be used:
-a  = add a user account
-x  = delete user account
-d  = disable user account
-e  = enable user account
-m  = add machine account (needed for PDC configuration)

contains documentation and configuration examples

contains all databases like users and passwords

contains Samba’s own log files.

The first clip demonstrate how to set up an easy file share open to everybody and in the second clip it demonstrate to set up an easy file share where specific users have access to. Later on I will write another article about How to set up a simple PDC with Samba. Enjoy those two Youtube Clips.

Here are the two parts for an easy share and how to add some security to it:

Part 1:

Part 2: