MandrakeUser.Org - Your Mandrake-Linux Knowledge Base!


 
 

*Main - DocIndex - Connectivity

SAMBA Setup I (Client)

* Introduction and Preparations
* Accessing Directories On MS Windows Systems

Related Resources:

Samba: An Introduction
Just what is SMB?
man smb.conf

Revision / Modified: June 05, 2002
Author: Tom Berger

 

* Introduction And Preparations

The SMB (Server Message Block) protocol is Microsoft's proprietary network resource sharing protocol, just like AppleTalk for Macs or SUN's NFS for UNIX machines.
SAMBA is a reverse engineered implementation of that protocol: basically those guys are looking at what SMB does and write code which emulates the observed behavior.
More background information on Samba can be found in Christopher R. Hertel's Understanding the Network Neighborhood Linux Magazine feature .

Basically, SAMBA allows you to

  1. access shared resources as an SMB client on MS Windows machines;
  2. provide resources as an SMB server to MS Windows machines;
  3. act as a client / server in a network of MS Windows machines.

This article will discuss each of these capabilities in this order.

I assume that your local network is up and running, i.e. you can ping any other machine on the network. If not, have a look at the article about Building A Small Mixed Network. It doesn't matter if you are using 'hosts' files or DHCP to assign dynamic IPs.

* Accessing Shared Directories On MS Windows Systems

I will not elaborate on how to configure the MS Windows machines for SMB. If you need help with this topic, check out these illustrated guides for MS Windows 98 orMS Windows XP.
How to configure remote printers via SMB is explained in the article on CUPS.

Install the 'samba-client' package via the Software Manager or from a command line as 'root' with

urpmi samba-client

For demonstration purposes I assume that the SMB machine name of the MS Windows system is 'win' and that there's a shared directory on that system with the name 'export'.

Choices

You have various methods to choose from when connecting to shared directories on MS Windows:
  1. Browsing them with the KDE 'Konqueror' file manager;
  2. using applications like 'Komba2' or 'LinNeighboorhood'; or
  3. configuring smb mount points in '/etc/fstab' via the 'Mandrake Control Center' or by hand.

Using 'Konqueror'

In order to access the shared directory 'export' on the machine 'win', you type

smb://win/export

into the location bar and press the 'Enter' key. If the share is password protected, you will be prompted for the password. After some seconds, the directory should appear.

Although this method is very comfortable when you are using Konqueror as your file manager, it currently has several - rather annoying - disadvantages:

  1. It's s l o w. Simple operations like copying files from the Windows machine to the Linux machine can take for ages.
  2. It's tedious. Konqueror will keep asking you for your share password for every action. Although you can set a default password in Configuration - KDE - Network - Windows Shares, this is only convenient when you are always accessing the same share or if your shares are all protected by the same password.
  3. No MIME type detection.
  4. Resource waste. I'm not sure if this is a local problem, but it looks like Konqueror does not care about cleaning up started 'smbclient' processes. So, every time you access that share via Konqueror, a new 'smbclient' process is started with the old one still running. Not good.

Komba2 and LinNeighboorhood

Possibly the most flexible and easy way to access a Windows share is via one of these applications. Both come with the 3 CD set of Mandrake Linux 8.2 and once installed can be started via 'Networking - Other'.

Komba2 detects and displays available shares on startup, . If your share is password protected, youhave to click the 'lock' icon first and enter your SMB user name and password for that share. If you don't do that, mounting the share will fail with a generic error message.

Mark the share you want to mount and click on the 'mount' icon. By default, Komba will mount shares to '~/komba/MACHINE/SHARE', in our example '~/komba/WIN/EXPORT'. It will also start up the Konqueror file manager in that directory. Both options and more can be configured.

To unmount the share (highly recommended since Linux sometimes doesn't take kindly to 'dead' Samba shares on shutdown), close the Konqueror window first and then click the 'unmount' button.

LinNeighboorhood works in a similar fashion. After first startup configure the 'workgroup' setting in the 'Preferences' window. Now right-click the entry for your machine in the window below and choose 'rescan group'. This might take a while, especially if there's a Windows XP machine in the workgroup (dunno why, maybe local problem).

Once you've reached a share, double-click it and a mount preferences window will appear where you can configure - if you want - some nifty options. By default, the share will be mounted under '~/mnt/MACHINE/share', in our example '~/mnt/WIN/export'.

Which one to choose? Well, 'Komba2' is faster, whereas 'LinNeighboorhood' offers more options. 'Komba2' uses Qt, the KDE widget set, whereas 'LinNeighboorhood' uses 'GTK' which makes for a more uniform look in GNOME. Try for yourself ;-)

Configuring smb mount points via the Mandrake Control Center or by hand

This is the 'old-fashioned' way of configuring static mount points. If you configure shares this way, you can mount them during boot, or even use something fancy like autofs to mount and unmount those shares automatically.

Open the Mandrake Control Center and choose 'Mount Points - Samba Mount Points'. Wait, scanning can take quite a while. If no machines appear, click on the 'Search Servers' tab in the upper left corner. Once the machines appear, double click their entries to display their shares.
For some reason (local problem?) MCC won't display shares on a Windows XP machine here, but maybe you are more lucky.

Mark the share and click 'Mount point'. Specify a mount directory (if it doesn't exist, it will be created). Next click on 'Options' and on 'Advanced'.

The 'user' option might be useful when you want normal users to be able to mount the share. 'noauto' is useful when the share usually isn't available on boot time.
You can specify your SMB user name and share password in the 'advanced' options. It should be obvious that this might be a security risk, since both will appear in clear text in '/etc/fstab'. But if you're sure no one except you has access to that file or you just don't care, go ahead.

When finished, press 'OK' and 'Done'. The new entry will be written to '/etc/fstab' and you can mount that file system like every other local file system.

An 'fstab' entry for an SMB share for the shared directory 'export' on our 'win' example machine would look like this:

//win/EXPORT /mnt/vmsmb smbfs user,noauto 0 0

The scheme is:

//SMB_server/share local_mount_dir smbfsoptions 0 0

You see, it's not that different from entries for local mounts. 'smbfs' is the file system of the SMB protocol. This overlay file system allows you to write to file systems which have no write support in Linux, like NTFS.

* section index * top

* Linux as an SMB Server


 
Legal: All texts on this site are covered by the GNU Free Documentation License. Standard disclaimers of warranty apply. Copyright LSTB (Tom Berger) and Mandrakesoft 1999-2002.