What permission do I need to add an HP printer with hp-setup?

I try to install my printer using the following command:

hp-setup 10.2.1.99

As you might expect my printer has the IP 10.2.1.99. It is a HP Color LaserJet 2700n.

Everything works well until the very last step when I have chosen the PPD file and clicked Add Printer. I then get prompted with a box where I can write Username and Password, and the text:

You do not have permission to add a printer

I've tried entering credentials to all accounts I can think of that exists in our office, but it does not seem to work.

If I press cancel when prompted, I get this text in the console:

Printer queue setup failed. Could not connect to CUPS Server. Is user added to "lpadmin" group(s)

What permission is it that I need?


Solution 1:

Add your user to the lp user group. Use the following command to accomplish the task:

# gpasswd -a [user] lp

Read the ArchWiki article on Users and Groups for more information on how Groups are used for access to certain system hardware.

Turns out there are multiple bugs on Launchpad regarding this issue. These may help:
https://bugs.launchpad.net/hplip/+bug/802780
https://bugs.launchpad.net/hplip/+bug/718092
https://answers.launchpad.net/hplip/+question/161346

Solution 2:

I needed:

sudo hp-setup

Adding myself to the lp group + logout + login did not work.

Tested on Ubuntu 15.10.

Solution 3:

You plugged in your printer with USB. Then restart your machine.

Normally it is sufficient to use this command without sudo (hplip package is installed) :

hp-setup

You concluded the setup. Normally this should be sufficient.

With hplip then cups is not necessary.

You might use lpadmin command as described here, only when cups is needed :

https://www.tek-tips.com/viewthread.cfm?qid=1672833