Every guide I've seen so far that explains how to print to a Windows print server from CUPS, indicates to put the username and password, in plain text, in the Device URI either in the web interface (localhost:631) or in the /etc/cups/printers.conf


The trouble is my password contains spaces and special characters. When I attempt this, I still get NT authentication failures when printing test pages. I can connect via smbclient:

smbclient -L //ourprintserver01 -Uourdomain\\myusername

I've tried to create a /etc/samba/printing.auth file with the correct username, password and domain in it, as I've seen in some tutorials, but this still doesn't allow cups to properly authenticate. Is there a way to tell CUPS to use this file, or keep the password, username and domain in some other file cups can use?

1 Answer 1


If you create the printer, either through the web ui or via lpadmin with a URL with the special characters % encoded like this:

lpadmin -p fake -v smb://bob:pass%20word@rice/BLAH -P /tmp/foo.ppd

then the password will be stored in the /etc/cups/printers.conf file (which is readable only by root) and will not be displayed in the web UI.

Be careful though as if you accidentally enter a malformed URL then the cups web-ui won't be able to figure out which bit is the password and it will be displayed.

  • Do I have to URL-encode the \ separating the user name and the domain? So should I assume it must be domain%5Cbob or domain\bob?
    – Anaphory
    Nov 15, 2019 at 11:26
  • No idea. try it and report back?
    – fledermaus
    Nov 18, 2019 at 19:33
  • You can enter the domain like this: smb://DOMAIN\user:password@foo/bar without further encoding. Dec 3, 2019 at 9:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.