Skip to content

Instantly share code, notes, and snippets.

@SAW4
Last active August 18, 2017 18:01
Show Gist options
  • Select an option

  • Save SAW4/eb5fc7c6145557ee4884f0c9a42ab904 to your computer and use it in GitHub Desktop.

Select an option

Save SAW4/eb5fc7c6145557ee4884f0c9a42ab904 to your computer and use it in GitHub Desktop.
Linux connect to Windows Printer through Samba

Linux connect to Windows Printer through Samba

The first thing: Install and launch service

Install stuffs
sudo pacman -S samba smbclient cups
Launch required services
sudo systemctl enable smbd nmbd winbindd //nmbd may not required, it used to resolve netbios name
sudo systemctl start smbd nmbd winbindd

Config your printer in CUPS

Go to localhost:631, enter remote printer the address
Your printer's address should look like smb://WORKGROUP/smb:password@SAMPC/HP%20Deskjet%201050%20J410%20series
format smb://{WORK_GROUP_NAME}/{print account}:{password}@{Remote server}/{printer name}

It should be okay, if not try next step:

Set printer address manually

You must stop the cups service first
sudo systemctl start org.cups.cupsd.service
Edit the conf file
sudo vim /etc/cups/printers.conf
It should be looked like this:

   
UUID urn:uuid:e80e3a5f-cca2-3691-7b55-8c7059ba873a   
AuthInfoRequired username,password   
Info HP-Deskjet-1050-All-in-One-Printer   
Location SecretBase   
MakeModel HP Deskjet 1050 j410 Series hpijs, 3.17.6   
DeviceURI smb://WORKGROUP/smb:password@SAMPC/HP%20Deskjet%201050%20J410%20series   
State Idle   
StateTime 1500012069   
ConfigTime 1500012044   
Type 8425484   
Accepting Yes   
Shared No   
JobSheets none none   
QuotaPeriod 0   
PageLimit 0   
KLimit 0   
OpPolicy default   
ErrorPolicy stop-printer   
   

Other useful tools

smbtree -U {username}
smbclient -L core -U cubieadmin -W workgroup - core=domain; cubieadmin=username

Tips

  1. Remeber that your remote printing server should not be suspended otherwise the connection will fail
  2. SAMBA is not routable by default, but you can set port-forwarding to router for routing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment