Categories
Hardware Productivity

Sharing a Windows printer with Debian GNU/Linux

In this blog post we will share a printer that is connected to a Windows PC with another system that runs Debian GNU/Linux.

Sharing the printer on Windows

First of all, on the Windows PC, it is required to have active the feature called File and printer sharing. This setting is within the Control Panel and it can be quickly found by pressing the Windows key and typing Manage advanced sharing settings. Having this feature checked will make the printers and other shared resources visible to the local network.

Windows 10 Advanced sharing settings
Advanced sharing settings on Windows 10

Setting up the printer on Debian GNU/Linux

In my experience, for adding a Windows printer on Debian GNU/Linux I needed to install first the Samba client by typing the following command on the Terminal.

apt-get install samba-client

Once this action is done, adding the printer using the CUPS web interface is the next step. CUPS (an acronym for Common UNIX Printing System) is the printing system for Unix-based operating systems. It can be accessed via web browser by typing http://localhost:631/.

CUPS home
CUPS homepage

Once there, we click on the Add Printer button. In case accessing CUPS prompts for User Name and Password, the default credentials are: User Name: root and Password: yourrootpassword.

In the next step, select Windows Printer via SAMBA (last option from the list):

CUPS SAMBA
You’ll see this option available if SAMBA was properly installed.

The anatomy of a printer path

It’s very important to understand the parts of the URL that goes on the next step, where you’ll need to add the printer’s connection path.

This is how the URL will look like: smb://HOSTNAME:PASSWORD@192.168.56.1/HOSTNAME/PRINTERNAME

Printer's path URL
Anatomy of the printer’s URL path running on a Windows machine.

HOSTNAME: this is the static IP of the machine in the local network. It can also be a name. Eg. LIVINGROOM.

PASSWORD: the Window’s machine login password is written here.

HOSTNAME: same name or number as the previous one. In the case of the example it would be LIVINGROOM.

WINDOWS PRINTER NAME: the printer’s name (without spaces) that Windows has given to the device to be shared.

Think before you print

This was an experiment that has been done for fun. It was my curiosity to learn how to share a Windows printer not only on other Windows machines, but also on my corporate MacBook Pro and my Debian VM. On macOS the setup was fairly simple. For Debian, I had to do some research to get it up and running.

As always, please consider the environment before printing something.

Leave a Reply

Your email address will not be published.