Kali Linux Printer Setup

From WikiMLT

In my case I was in need to set­up my HP 1022 print­er to work with Kali Lin­ux. Af­ter the fol­low­ing set­up it works great. In this guide are used the tools cups, cups-client and foomat­ic-db, which are not in­stalled and en­abled by de­fault in Kali Lin­ux.

CUPS pro­vides the Sys­tem V ("lp") and Berke­ley ("lpr") com­mand-line in­ter­faces, a con­fig­urable web in­ter­face, a C API, and com­mon print fil­ters, dri­vers, and back­ends for print­ing. The cups-fil­ters project pro­vides ad­di­tion­al fil­ters and dri­vers.

Foomat­ic Data­base is a col­lect­ed knowl­edge about print­ers, dri­vers, and dri­ver op­tions in XML files, used by foomat­ic-db-en­gine to gen­er­ate PPD files.

In­stall the re­quired Pack­ages and Deal with the Per­mis­sions

In­stall the re­quit­ed pack­ages.

sudo apt update
sudo apt install cups cups-client "foomatic-db"

The users will be added to the lpad­min group au­to­mat­i­cal­ly af­ter in­stalling the above pack­ages, but we will do that man­u­al­ly just in case.

sudo adduser root lpadmin
sudo adduser $USER lpadmin

En­able and start CUPS ser­vice.

sudo systemctl enable --now cups.socket
sudo systemctl enable --now cups.service

Restart CUPS and Sam­ba ser­vices.

sudo systemctl restart cups.service
sudo systemctl restart smbd.service

Find USB Print­er

lsusb | grep 'HP'
Bus 001 Device 003: ID 03f0:2c17 HP, Inc LaserJet 1022
sudo netstat -pnat | grep 631
tcp      0    0 127.0.0.1:631    0.0.0.0:*   LISTEN      1217/cupsd          
tcp6     0    0 ::1:631          :::*        LISTEN      1217/cupsd
Figure 1. Add a print­er via Gnome Con­trol Cen­ter.

Con­fig­ure the Print­er

There are two pos­si­ble ways to con­fig­ure the print­er – via the web in­ter­face of CUPS or via the Gnome set­tings. I pre­fer the sec­ond method, il­lus­trat­ed at Fig­ure 1. In both cas­es you need to use your user's cre­den­tials to ad­min­is­trate the print­ers.

To con­fig­ure a print­er via the web in­ter­face of CUPS nav­i­gate to the ad­dress http://127.0.0.1:631/admin with­in your brows­er, the go to the Ad­min­is­tra­tion sec­tion and click at the but­ton Add Print­er.

Ref­er­ences