1

How do I disable automatic remote printer installation in 20.04?

My neighbor has a printer on our shared wifi network. Every time I go to print something, his printer shows up as an available printer. I have removed it multiple times, and it keeps reappearing, sometimes within seconds.

I tried (1) disabling cups-browsed as suggested in this very old thread and (2) sudo apt purge cups-browsed, but the printer continues to reappear in the print dialog box and Settings > Printers (even after purging cups-browsed).

The printer appears in avahi-browse -rt _ipp._tcp. But it does not appear in lpstat -t, even when the printer is visible and listed as "Ready" in Settings > Printers.

Bolio
  • 307
  • 3
  • 12
  • Is your Wi-Fi secured? It seems as if your neighbor has setup their printer on your Wi-Fi network? – Enterprise Feb 03 '21 at 17:07
  • 1
    @PJSingh I was wrong. We share a wifi network, and the printer is on our shared network, not (as I incorrectly thought) a wifi direct printer. Mea culpa. – Bolio Feb 03 '21 at 19:42
  • This makes more sense, considering the symptoms you described. Since you share a Wi-Fi network, the ideal solution is to disable Wi-Fi direct on the printer. Is this something that is possible?... It depends on your relationship with your neighbor and your agreement about resources on your shared network. – Enterprise Feb 03 '21 at 20:21

3 Answers3

2

You will want to set the BrowseProtocols directive to none in your cups-browsed.conf file. Here's how to do it:

  1. Open Terminal (if it's not already open)

  2. Open /etc/cups/cups-browsed.conf for editing with sudo

  3. Find the line with BrowseProtocols and uncomment it by removing the #:

    # BrowseProtocols none
    

    Becomes:

    BrowseProtocols none
    
  4. Restart the cups-browsed service:

    sudo service cups-browsed restart
    

That should do it

1

The only thing I have found so far that works is to disable avahi-daemon with sudo systemctl disable avahi-daemon. So far that hasn't broken anything else I do.

Bolio
  • 307
  • 3
  • 12
  • 1
    Wi-Fi Direct doesn't advertise itself via Bonjour (avahi). A Wi-Fi Direct printer is seen from its wireless broadcasts.Therefore it is not part of the issue. – brian_p Feb 03 '21 at 22:28
  • Good, that hopefully works for me too. But don't we agree this auto-discover is not good to have enabled by default?! @brian_p – stephanmg Jun 09 '21 at 11:22
0

cups-browsed manages devices on your network. It wiil not manage devices on a neighbour's network, so there isn't any point in configuring it to try.

Furthermore, the neighbour's printer is using Wi-Fi Direct and is acting as it's own wireless AP. It is in the nature of wireless broadcasts that you will see the printer.

You can do nothing about the situation.

Additionally, and completely idependently, the printer is probably using Bonjour broadcasts to advertise its presence. The Gnome GTK printing subsystem appears to detect these and displays the printer. Disabling avahi-daemon prevents the printer from being seen. There is no other solution.

The problem is not Wi-Fi Direct or CUPS but lies in Gnome.

brian_p
  • 836
  • Thanks. That seems suboptimal, to say the least. But I'm not sure it fully explains what's going on: If I go to Settings > Wi-Fi, I see dozens of people's networks and printers. But there is one particular one that "installs itself" repeatedly as a usable printer and is visible in the print dialog box and unter Settings > Printers, even after removing it and no matter what my cups-browsed settings are. It is the latter situation that is problematic. Is there seriously no way of preventing Ubuntu from installing a printer against my will? – Bolio Feb 03 '21 at 14:32
  • It installs itself even after cups-browsed has been purged? – brian_p Feb 03 '21 at 14:56
  • It appears to do so, but it may not actually be installed. Original question edited with new information. Thanks! – Bolio Feb 03 '21 at 17:20
  • 1
    For a printer to have the potential to be installed it (an EPSON_XP_830_Series) would be expected to show up in the output of avahi-browse -rt _ipp._tcp. To be actually installed it would be in lpstat -t. – brian_p Feb 03 '21 at 18:18
  • Thanks. That was helpful. Disabling avahi-daemon did the trick, with no apparent downside as yet. – Bolio Feb 03 '21 at 19:46
  • Suppose you restore avahi-daemon. Does the printer shows up as an available printer in whatever Gnomr application you are using? Now stop cups: systemctl stop cups. Is the printer still there? – brian_p Feb 03 '21 at 20:48