Linux Step By Steps

Using SAMBA To Share Printers

By: Susan Macchia

Date Submitted: Feb. 9, 2001
Date Updated: May 19, 2003


This Step by Step assumes some understanding of Samba and how to use SWAT.

My Setup:

I have a cable modem hooked connected to a Cable/DSL router (which has the firewall).

My Dell Dimension 400 mhz system is a dual boot with Caldera eDesktop 2.4 (COL 2.4) on a 30G disk and Windows 98 on a 12G disk. This machine is always running COL 2.4 and has the printer hooked directly to it. Its hostname is susan( Its running the 2.2.14 kernel (or 2.2.14w41 Win4Lin kernel) and Samba 2.0.6-2.

I have another Compaq Presario running WindowsME hooked up the the router. Its hostname is Windows.

I wanted the Compaq to be able to access the printer on my Dell box, but not to share any other resources.

What I did:

There are a variety of ways to set up Samba. Since I only wanted to share the printer, I went with the simplest approach. I set it up as a Peer to the Windows box. In this configuration, the Dell (COL 2.4) box is the primary domain control (PDC) and serves as the NT PDC replacement. I used SWAT to configure Samba.

I created a user to be the default Samba user with sufficient priviledges for printing (called smbuser).

I created a directory where there is space for the print jobs. On my system it was /mnt/hdb2/printerShare.

Below is my version of /etc/samba.d/smb.conf (/etc/samba/smb.conf on RH 8.0):

# Samba config file created using SWAT
# from localhost (
# Date: 2001/02/04 19:29:11

# Global parameters
workgroup = MACCHIA
server string = Samba Server on Caldera OpenLinux
encrypt passwords = Yes
map to guest = Bad Password
max log size = 50
logon script = %U.bat
domain logons = Yes
preferred master = Yes
domain master = Yes
dns proxy = No
wins support = Yes
guest account = smbuser
printing = lprng
printer driver location = \\susan\\PRINTER$

comment = All Printers
path = /var/spool/samba
write list = @users
create mask = 0700
guest ok = Yes
print ok = Yes
printer driver location = /tmp

path = /mnt/hdb2/printerShare
guest only = Yes
guest ok = Yes
print ok = Yes

In /etc/samba.d/lmhosts, I added the following line:
Windows Windows
I created a user with some reasonable priviledges for samba called 'smbuser'. Here is my /etc/samba.d/smbusers:
# Unix_name = SMB_name1 SMB_name2 ...
root = administrator admin
smbuser = guest pcguest smbguest


/mnt/hdb2 is not my root partition, but where I put other stuff. I have moved all users there so when I muck things up so bad that I have to re-install (which hasn't happened in quite a while), I don't have to lose the user directories, and optional software installations. I could have partitioned my disk appropriately, but I was a real sys admin newbie when I first installed Linux.

/mnt/hdb2/printerShare also contains all the windows drivers (copied from the CD), but I am not sure that they are needed, for 2 reasons: (1) notice that the driver location says /tmp, (2) when I created the new printer in windoze, I used the CD to get the drivers. I may change the "printer driver location" in the [printers] section to point to the share directory, as it does in the [global] section.

A note of caution:

I find that if I reboot the Linux box while the Windows box is up, the windows box loses its ability to see the Linux box and I have to reboot the Windows box.

I have also noticed that the windows box occasionally loses the ability to see the COL box for no apparent reason. In this case a reboot seems to restore the connection.

Finally, if you need to set up additional user shares, encrpted logins would be required and that is beyond the scope of this document.