How To Enable Authenticated Printing On Linux

November 26, 2020
November 26, 2020
a screenshot of the printers available on my machine In addition to sharing files and folders over samba, you can also share printers. This example was attempted with an HP Envy 5055 on a Class B private network with the server running Linux Mint Ulyana 20.04 and the client running Linux Mint Debian Edition 4. Authentication was turned on to allow for a specific server user to print. This way, the visibility of my printer on the network wouldn't be a liability as they'd be forced to connect to my user account to print. Most internet tutorials I came across insisted this feature be turned off. I disagree.
To compete this tutorial, you'll need to have or do the following:
• have a printer on the same network as the client and server
• allow traffic to and from port 631 on the firewall of the server client
• create a sambashare password for the user you want to connect as
• enabled guest access via /etc/samba/smb.conf starting on Line 223

First, you will need to share your printer. Open the mint menu, and type "Printers" and click on the resulting entry, whose icon resembles a top feeding printer. Click the "Server" menu, and select "Settings" from the drop down. Check the box that says "Publish shared printers connected to this system", and then click OK. Now right click the printer you wish to share, and check the box "Shared" from the drop down. Right click the printer again, and then select "Properties". Under Policies, click on the drop down next to "Operation Policy" and select "Authenticated". Under "Access Control", type the username of the account you wish to route printing through, and then click the "Add" button. Click "Apply" or "OK" to save your settings.
a screenshot of the printer properties policies tab a screenshot of the printer access control tab Now we will enable guest printing via smb.conf. Open a terminal and type the following command:
sudo xed /etc/samba/smb.conf You will be asked for your password. Provide it, and then navigate to line 223 (if you recall from a previous tutorial, I added three lines to this file already to force my local user to work with encrypted shares), where the "[Printers]" directive is, and make sure the "guest ok" flag is set to "yes". Save and close smb.conf.
Next is the firewall rule. Open up the Linux Firewall from the mint menu and enter your privileged account password when prompted. Once the Linux Firewall home page opens, press the "+" icon on the bottom left, and then the "Simple" tab on the resulting window. Select "Both" for "Direction", "Both" for "Protocol" and "631" for "Port". Click "Add". There will be no visual confirmation, only a ticker on the foreground window saying "Rules(s) Added". Close the Firewall app.
a screenshot of the Linux Firewall start page a screenshot the Add Firewall Rule simple dialog showing port 631 Open the mint menu, type "Printers" and select the resulting icon that resembles a top feeding printer. A window similar to the title image will appear. On the top left of the windows BELOW the menu bar, click "Add". Select "Network Printer" and it will produce an expanded tree of available printers on the same network. Select your printer from the list and click the "Forward" button on the bottom right. You'll be asked to provide a name for it in the Printers Menu, another name for programs, and its location. When finished, click "Apply". If drivers are not installed, Linux will attempt to locate them.
Open a text program, type some random text and then attempt to print it. You will see your networked printer appear in the list. Once you click "Print", an authentication window will show up. You will enter the username and samba password of the user you added to the printer's access control list. Once you do, the job will complete.
- 🎙
© 2020 Mass Transit Honchkrow