Configuring Samba 3.0 to act as a Windows File Server

One of the most common roles for a Linux server on a predominately Windows network is as a file and printer server. The effectively free price of Linux makes it a very attractive alternative to the Windows server family. To act as a Windows file and printer server, Linux requires the Samba package, which implements the Windows file and printer sharing protocol (known as SMB or CIFS) under Linux/UNIX.

Installing Samba

A copy of Samba 3.0.0 is included on the PC World January 2004 cover CD. Your Linux distribution may include a copy of an earlier version. Unless you want to use the advanced Active Directory features included in Samba 3.0.0, the version included with your distribution is suitable to perform the tasks outlined in this article.

To compile Samba from the cover CD, copy it to your hard drive and type the following in a shell:

$ bunzip2 -c samba-3.0.0.tar.bz2 | tar xv
$ cd samba-3.0.0/source
$ ./configure
$ make

Once Samba has built, you will need to become the super user (if you are not already logged in as root) by typing ‘su’ and entering the root password. To install your freshly compiled copy of Samba, type the following:

$ make install

Configuring Samba

Samba uses plain text configuration files. The default version of each configuration file is loaded with helpful explanations of each setting and is well worth reading before making changes. The Samba configuration files are commonly located in /etc/samba/ or /usr/local/samba/lib/, but your distribution may place them elsewhere. The configuration file you need to edit is named smb.conf. Here is an example of an smb.conf file which will share a single directory on your Windows network. (Line numbers have been added to aid explanation; be sure to remove them if you copy the example into your own configuration file.)

1: [global] 2: workgroup = WORKGROUP 3: server string = Linux computer 4: [share1] 5: comment = Example share 6: path = /usr/local/public 7: public = yes

The first section of the smb.conf is the global configuration, as indicated by the header on line 1. In this section you can define settings, for example, the workgroup to which the server belongs (line 2), and the name attributed to the computer when listed on the network (line 3). Shared drives can be defined after the global section. Each shared drive must be given a name, such as share1 (line 4). Line 5 is a comment describing the purpose of the share. Line 6 specifies the path that will be shared under this share. Line 7 allows the share to be mounted without the need to enter a password.

Once you have tweaked your con­figuration settings in smb.conf, it is important to test them with the testparm program. Type the following in a shell to verify your configuration settings:

$ testparam /etc/samba/smb.conf

To start the Samba server, as root type the following in a shell:

/etc/init.d/samba start

You should now be able to see your Linux computer on your Windows network when exploring the Network Neighbourhood.

If you have trouble connecting to your Samba server because of a bad password, you will need to add a user to your Samba password file. To do this, type:

$ smbpasswd -a

You will be prompted to enter the password for the user twice before the account is created. Creating a Samba user requires a user with the same name that already exists on your Linux computer.

More advanced Samba documentation can be found in the Samba HOWTO located at:

Browsing Windows servers under Linux

Samba also includes a handy client, creatively named smbclient, which can be used to test your Samba server or to browse other Windows servers. To connect to a Windows server using smbclient, type the following:

$ smbclient //servername/sharename -U username

Change username to a working system login for the computer you are connecting to. After connecting you will be greeted with a prompt similar to:


From here you can use many standard FTP commands such as:

cd — change directory
dir — list directory contents
get  — download  to your computer
put  — upload  to the server

A full list of commands is provided in the smbclient man page which can be accessed by typing:

$ man smbclient

Join the PC World newsletter!

Error: Please check your email address.

Our Back to Business guide highlights the best products for you to boost your productivity at home, on the road, at the office, or in the classroom.

Keep up with the latest tech news, reviews and previews by subscribing to the Good Gear Guide newsletter.

Alastair Cousins

PC World
Show Comments

Cool Tech

Crucial Ballistix Elite 32GB Kit (4 x 8GB) DDR4-3000 UDIMM

Learn more >

Gadgets & Things

Lexar® Professional 1000x microSDHC™/microSDXC™ UHS-II cards

Learn more >

Family Friendly

Lexar® JumpDrive® S57 USB 3.0 flash drive 

Learn more >

Stocking Stuffer

Plox Star Wars Death Star Levitating Bluetooth Speaker

Learn more >

Christmas Gift Guide

Click for more ›

Most Popular Reviews

Latest News Articles


GGG Evaluation Team

Kathy Cassidy


First impression on unpacking the Q702 test unit was the solid feel and clean, minimalist styling.

Anthony Grifoni


For work use, Microsoft Word and Excel programs pre-installed on the device are adequate for preparing short documents.

Steph Mundell


The Fujitsu LifeBook UH574 allowed for great mobility without being obnoxiously heavy or clunky. Its twelve hours of battery life did not disappoint.

Andrew Mitsi


The screen was particularly good. It is bright and visible from most angles, however heat is an issue, particularly around the Windows button on the front, and on the back where the battery housing is located.

Simon Harriott


My first impression after unboxing the Q702 is that it is a nice looking unit. Styling is somewhat minimalist but very effective. The tablet part, once detached, has a nice weight, and no buttons or switches are located in awkward or intrusive positions.

Featured Content

Latest Jobs

Don’t have an account? Sign up here

Don't have an account? Sign up now

Forgot password?