-   Linux - General (
-   -   CUPS to CUPS through SSH port forwarding (

Uqbar 08-03-2011 11:59 AM

CUPS to CUPS through SSH port forwarding
I have a remote machine running CUPS and managing a locally (USB) connected printer. Everything works fine as expected.

I have another machine also running CUPS for a number of printers that are either local or on the same LAN of the server. Also this works fine.
I need to be able to print from this server on the first remote machine's printer.
I managed to have a remote forwarding like this on the remote machine:

machine# ssh -C -N -T -R root@server

( is a dummy interface on the server)

This means that any connection on TCP port in the server will be forwarded straight to TCP port on the remote machine with the printer.

On server's CUPS web UI I've tried to add a printer (with the proper driver) like this:


The printer in the remote machine doesn't print anything.
The logs say:
Unable to get the printer status (Bad request)

How can I add the remote machine printer to the server's CUPS configuration?

Thanks in advance.

mpapet 08-04-2011 05:41 AM

Are port 631 TCP and UDP packets being forwarded correctly? Does the printer have TCP/UDP stuff that needs to be forwarded?

Wireshark can help you figure this out.

allend 08-04-2011 11:06 AM

Is the printer on the remote machine configured for shared access? Check that "Shared Yes" appears in section for the printer in the output of 'cat /etc/cups/printers.conf', or use the web interface.

Does the remote machine allow remote access in cupsd.conf?

# Allow remote access
Listen *:631

On the local server in cupsd.conf you will need lines like

# Show remote shared printers
BrowseRemoteProtocols CUPS

to show the remote printer.

Uqbar 08-05-2011 06:34 AM

I've tried a number of options in the configuration files as well as tcpdump (the CLI equivalent for wireshark).
I finally found the way to refer to the IPP printer properly (RTFM as usual) and even traced the IPP packets to from source to destination. Everything was fine, but no print was coming out, as stated by the CUPS logs.
Then I've filed a bug to CUPS/Apple:
The response is quite disappointing: you won't ever do that.
Of course, by sharing the printer with SAMBA and forwarding that protocol (TCP:139) I have been able to do it.

Just for the sake of completeness, the point is simple.
IPP is actually http on port 631, so CUPS is a web server that uses the same TCP port for both print job submissions *and* CUPS configuration. The designers decided to protect just the port 631 and not just the CUPS configuration service (which uses a different URL than submission).

All times are GMT -5. The time now is 11:04 PM.