"Unauthorized" error when adding printers through CUPS using Google Chrome in Ubuntu 18.04 LTS

16,165

Solution 1

Update 2019-01-09: I have found that CUPS 2.2.8 works without a problem with Google Chrome in Ubuntu 18.04. I downloaded and installed it from https://launchpad.net/ubuntu/+source/cups/2.2.8-5ubuntu1.2

Please note that the bug for CUPS 2.2.7 is filed at: https://bugs.launchpad.net/ubuntu/+source/cups/+bug/1769893


CUPS 2.2.8 installation steps

Run all the following from a terminal window.

Install the prerequisites:

sudo apt install autoconf build-essential libavahi-client-dev \
    libgnutls28-dev libkrb5-dev libnss-mdns libpam-dev \
    libsystemd-dev libusb-1.0-0-dev zlib1g-dev

Download CUPS 2.2.8 and extract it and enter the new directory created:

cd /tmp
wget -c https://launchpad.net/ubuntu/+archive/primary/+sourcefiles/cups/2.2.8-5ubuntu1.2/cups_2.2.8.orig.tar.gz
tar zxvf cups_2.2.8.orig.tar.gz
cd cups-2.2.8

Run the configure, make and make install:

./configure
make
sudo make install

You might want to put a hold on CUPS so it doesn't update back to 2.2.7 which still has the issue with unauthorized:

sudo apt-mark hold cups

Then all you should have to do is restart the cups.service:

systemctl restart cups.service

Check if the service is running:

systemctl status cups.service

If CUPS fails to restart, reinstall the daemon then restart the service again:

sudo apt install --reinstall cups-daemon
systemctl restart cups.service

Then access in Google Chrome http://localhost:631

The CUPS homepage might show 2.2.7 still, but try clicking on Administration and it should show 2.2.8.

enter image description here

Hope this helps!

Solution 2

I came across this solution when I was having the problem "in general" (not a browser specific issue) and the thing that ended up working for me was to add my user to the lpadmin group:

sudo usermod -aG lpadmin <USERNAME>

and then reboot.

Solution 3

Update to latest Ubuntu.

For me,this issue was solved when I updated Ubuntu from 18.04 LTS to 20.04 LTS.

Share:
16,165

Related videos on Youtube

Terrance
Author by

Terrance

I've been working in the computer industry for the past 27+ years. For the past 11 years I have been working in an eBay Data Center as a software technician systems administrator. Have worked for Packard Bell/NEC, Intel/Dayna Communications, Computer City/CompUSA and Cyber-Net Slash Support. I don't know everything about Linux as it is ever changing and always so much to learn. But I do love everything about Ubuntu that I know so far. I am always willing to help where I can, and I am eager to learn.

Updated on September 18, 2022

Comments

  • Terrance
    Terrance over 1 year

    Update 2019-01-09: Please see answer below as there is a way to fix this with CUPS 2.2.8.

    Update 2020-10-17: Upgrading from 18.04 LTS to 20.04 LTS will fix it as it upgrades the version of CUPS from 2.2.7 (which contains the bug) to version 2.3.1 which does not have the bug. Since some users may not be able to upgrade to 20.04 LTS right now this is still very valid for the 18.04 LTS users.


    I have Ubuntu 18.04 LTS installed clean on this system. When I try to add a printer through CUPS 2.2.7 address of http://localhost:631 in the Chrome browser, I can't add the printer as I keep getting Unauthorized. It never asks for a login. How do I add my printer through CUPS using Google Chrome?

    BTW, Firefox, Chromium and other browsers so far seem to work fine for adding a printer in CUPS 2.2.7. It appears to be a bug between CUPS 2.2.7 and Google Chrome.

    Unauthorized: Enter your username and password or the root username and password to access this page. If you are using Kerberos…

    • Yanick Rochon
      Yanick Rochon over 5 years
      Why is this question closed? CUPS is broken, and this question is quite valid!
    • Terrance
      Terrance over 5 years
      @YanickRochon We have reopened this question and I have added info below in the answer.
    • Martijn Courteaux
      Martijn Courteaux over 3 years
      For people stumbling upon this when searching the error: just use Firefox.
    • pkeller
      pkeller about 3 years
      For other people coming across this: the Vivaldi browser also has this problem - as @MartijnCourteaux says, try Firefox
  • Apologician
    Apologician about 6 years
    I always had to use a different browser to resolve this issue. Great information. Upvoting for sure.
  • solsTiCe
    solsTiCe about 6 years
    Yes this seems to work but I can't simply change the printer options. I am given back the page "Not authorized" even though I can add printers !!!
  • solsTiCe
    solsTiCe about 6 years
    Well, I used gnome-control-center to do that finally
  • Terrance
    Terrance about 6 years
    @solsTiCe Yeah, I think that is a bug between the two. I can't do the administration itself of the printer either. However, I have found that when I add the printer through CUPS this way regardless of the browser, apps in Wine will actually see and use the printer.
  • Terrance
    Terrance about 6 years
    @solsTiCe I filed a bug report at bugs.launchpad.net/ubuntu/+source/cups/+bug/1769893
  • abu_bua
    abu_bua almost 6 years
    cost my 1h to check it, that login has to be added to the link! 8(
  • Raga
    Raga over 5 years
    This doesn't work for me. I also tried clearing the browser cookie for localhost:631. Can't get it to ask me for user/pass.
  • Raga
    Raga over 5 years
    Using Firefox works.
  • Terrance
    Terrance over 5 years
    @jrennie If you read the whole thing, it says you go to localhost:631/admin/login to get the login to work. However, it does not stay at all and that is why I filed a bug against it. Firefox has always worked and that is what I stated in the question I wrote.
  • hakre
    hakre over 5 years
    Installing from source didn't work out for me at all. Goes through green, but just does not install - old version stays. Removing cups and then installing 2.2.8 has no webservice even when restarted - Actually now I can't even easily install cups again, the previous 2.2.7 version one ... I figure it eventually out.
  • Terrance
    Terrance over 5 years
    @hakre It is the cups-daemon that controls the webservice. I did add that right before the last pic in my answer here. Also, the CUPS home page might still show 2.2.7, but the administration and the tab title will show 2.2.8.
  • hakre
    hakre over 5 years
    @Terrance: Yes, that could be. I could restore by removing and then purging cups and cups-daemon, then installing both again. After doing so, everything worked again when I used the system configuraiton dialog (not the webinterface) to add a new printer. On one computer I could also add a printer via the webinterface again after reinstalling. On the other test system it didn't at least not directly and I tried the system dialog which worked. Ubtun 18.04 on both, and both were migrated from 16.04.