Saturday, September 5, 2009

Printing to a Windows printer via Samba in Slackware

You want to print from a Slackware machine to a printer that is connected to a Windows machine on the same LAN. To achieve this, Windows host must have a share for this printer with a specified share name. Then it is easy to configure a Windows printer from a GNU/Linux client (Slackware machine) via SAMBA and CUPS.

One can share files and printers between GNU/Linux and Windows machines over a network via SAMBA. CUPS provides a portable printing layer for UNIX-based operating systems such as GNU/Linux and Mac OS X. Latest Slackware release (Slackware 13) includes both "samba'" and "cups" packages. If you did not install these packages while installation, install them from the main tree in the installation DVD. Make sure that samba and cups run at startup by making /etc/rc.d/rc.samba and /etc/rc.d/rc.cups executable.

# chmod 755 /etc/rc.d/rc.samba
# chmod 755 /etc/rc.d/rc.cups

Create a samba configuration file by;

# mv /etc/samba/smb.conf-sample /etc/samba/smb.conf

Now you need to start samba and cups services by;

# /etc/rc.d/rc.samba start
# /etc/rc.d/rc.cups start

To configure a Windows printer properly via Samba and CUPS, you need to know the name of the work group of the Windows printer host (not always required), NET-BIOS host name of the Windows printer host (always required) and share name of the Windows printer (always required).

You can view shared printers and disks on a Windows machine by smbclient command with below options.

$ /usr/bin/smbclient -L net-bios_host_name_of_the_windows_machine -N

For my case, ertan is the NET-BIOS host name of my Windows box.

bash-3.1$ smbclient -L ertan -N

Domain=[ERTAN] OS=[Windows 5.1] Server=[Windows 2000 LAN Manager]

Sharename Type Comment
--------- ---- -------
D$ Disk Varsayılan değer
Belgelerim Disk
print$ Disk Yazıcı Sürücüleri
HpDeskjet1280 Printer HP Deskjet 1280
ADMIN$ Disk Uzak Yönetici
C$ Disk Varsayılan değer
Domain=[ERTAN] OS=[Windows 5.1] Server=[Windows 2000 LAN Manager]

Server Comment
--------- -------

Workgroup Master
--------- -------

Connect to CUPS administration panel by typing http://localhost:631/ into your favorite browser and add Windows printer to CUPS as following.

Add New Printer --> 
Name: Specify a name
Location: Specify a location
Description: Enter a description
Device: Windows Printer via SAMBA
Device URI: smb://server/printer





Manufacturer and Model Name: Choose driver

For Device URI (Uniform Resource Identifier), insert the correct server and printer share name. If system needs wokgroup, username and password, insert them correctly also.

(workgroup: Name of the work group of the Windows printer host
server: NET-BIOS host name of the Windows printer host
printer: Share name of the Windows printer
username:password: Username and password authorized to use the shared printer on the Windows machine)

For manufacturer and model type, variety of drivers will be listed, because Slackware includes "Gutenprint" (formerly Gimp-Print) driver package.

Finish printer installation verifying root user name (root) and password (root's password) and print a test page to check whether your samba network printer installation successfully performed or not.

1 comment:

  1. Hi, thanks for the article. Got my windows printer working with slackware thanks to your guide