As with other major, popular Open Source tools we've seen here, Samba comes
with most mainstream Linux distributions. It will be installed automatically
if you request it and some basic configuration will be done for you. Again,
I will reiterate my standard disclaimer. This section is considered a
basic introduction to Samba. I just saw that one of Open Source luminary
Bruce Perens' guides which is dedicated to Samba comes in at just under 700
pages, so you can imagine that there is a lot of ways to configure and
use Samba. We'll try to deal with some of the more common configuration
options here
User accounts for Samba
If you're thinking about letting people using Windows machines
store files on your Linux server, you'll need to create user accounts
on the Linux machine. If you've gotten this far in the lessons, we'll assume
that you know how to do this and skip the how-to part.
Next, you'll need to give them the same Samba password. There is a
program to do this which is appropriately named smbpasswd
Let's say you wanted to add a user bsmith. You would
type the following
This will ask you to type a password twice, as is the Unix custom.
You should give the users the same password that they
have on the Windows machine if you want the little
Network Neighborhood icon to let them in "automagically".
Now, when user bsmith logs in to his Windows machine and clicks on the
network icon, he should see our Linux machine running Samba. When he
clicks on the machine's icon, he should then be able to see an icon for
his Linux user directory. He can then begin leaving his files there - that is
- if Samba is correctly configured. Let's look at Samba's configuration file,
smb.conf.
smb.conf
The main Samba configuration file can normally be found in /etc/samba/ and it's
called smb.conf. This file is placed here when you install Samba. The developers
of Samba have done a great job commenting it to explain to you what every
line means. The first one we'll need to do something with is this one:
This is where you need to enter the name of your Windows workgroup. That's
pretty self-explanatory. Let's move on to the next.
load printers = yes
printing = cups
printcap name = cups |
These line are there to provide print services. CUPS (or Common Unix
Printing System) is an extremely reliable and well supported
protocol. This must installed and running in order for this to work,
of course.
Now we need to make additions and modifications in our printers section
so that Windows machines will use CUPS to print. Modify your [printer]
section to this:
[printers]
path = /var/spool/samba
browsable = no
public = yes
guest ok = yes
writable = no
printable = yes
printer admin = root |
And add this section:
[print$]
path = /etc/samba/drivers
browsable = yes
guest ok = no
read only = yes
write list = root |
We now need to have CUPS put all of the drivers it has at the disposal of Samba.
The CUPS software comes with a tool to do this. It's called
cupsaddsmb. Type:
This will add all CUPS printer drivers to your Samba setup. Just a word of
caution. Printing, in my experience, is a tricky thing. You may have the
most ultra-new printer on the block and it may not work right away. You
need to be fairly certain before hand that your printer has had some time
on the market for the appropriate drivers to have been made available.
Most printers from well-known manufacturers should work.
Once print services have been set up, we need to look at the file sharing
configuration options. First, we need to look at how the /home directories
of users are going to be handled.
[homes]
comment = Home Directories
browseable = no
writable = yes
create mask = 0700
directory mask = 0700 |
This will insure that other people will not be able to look around (browse) files
and won't be able to create and/or overwrite files or create directories (notice
the 00 given to group and others). Only the owner of the directory will be able
to write to it.
We may want to configure a particular directory on our Linux box to contain
files for everybody to see. Take the following example which is actually
on a network I recently set up in an office. They are using Hylafax to
send and receive faxes. So I have set up a Samba share so they can automatically
look at received faxes.
[Fax_Rec]
comment = Incoming Faxes
browseable = yes
writable = no
path = /var/spool/hylafax/recvq
public = yes |
With a TIFF viewer, people at Windows workstations will be able to see
the faxes that come in to the office.
Samba will also give you the ability to share CD drives as well. All
you have to do is uncomment the lines pertaining to this in the smb.conf
file and add a line like the following to your /etc/fstab
/dev/hdX /mnt/cdrom iso9660 defaults,noauto,ro,user 0 0 |
where 'X' is the letter corresponding to your IDE CD ROM drive.
Plenty of documentation
I think this shows how versatile Linux is. You can make a Windows NT out
of a Linux box running Samba if, like many organizations, you have a
number of Windows machines. Again, we have just scratched the surface
of what Samba is capable of. Have a look at the documentation that comes
with Samba and you'll find a wealth of information about it.