Find the answer to your Linux question:
Results 1 to 9 of 9
I'm trying to setup my laptop so I can print to my university's printer after SSHing in. I must be able to do this without root access (on the server) ...
  1. #1
    Just Joined!
    Join Date
    Feb 2009
    Posts
    4

    Ssh cups

    I'm trying to setup my laptop so I can print to my university's printer after SSHing in. I must be able to do this without root access (on the server) so some solutions won't work. The printer is a HP LaserJet 9000 or 9040... MFP (not sure bout MFP part). I tried setting up a SSH tunnel and port forwarding but didn't work. I thought CUPS uses lp/lpr so I thought with SSH I could make CUPS send commands through the connection but can't find instructions online.

  2. #2
    Linux Guru
    Join Date
    Jan 2009
    Location
    Dover, NH
    Posts
    1,633
    Actually, CUPS uses its own port to communicate to a server (631 I think). If the server uses CUPS, you shouldn't need to know the printer model, it always takes a postscript file as input.

    This would be the key probably to using lpr over ssh. I could do this as a two stage process, 1 print to a post-script file, 2. feed the file into the server's lpr.

    Is there a way to get CUPS to do this from the application instead? Honestly, no idea. I've never tried it, and as you said, documentation is kind if slim in this department. Interesting Q though, I shall like to look into it.

  3. #3
    Linux Guru
    Join Date
    Jan 2009
    Location
    Dover, NH
    Posts
    1,633
    Hey, have you seen these documents? They may be able to help you.

    Using ssh Port Forwarding to Print at Remote Locations

    Using a CUPS printer from command line

  4. #4
    Just Joined!
    Join Date
    Feb 2009
    Posts
    4
    That first one requires root access on the server (which I cannot have). The second includes CLI commands. I'm looking to setup a CUPS printer so I can print from FF, OpenOffice, etc rather than command line.

  5. #5
    Linux Guru
    Join Date
    Jan 2009
    Location
    Dover, NH
    Posts
    1,633
    I have an idea, I don't know if it will work, it'll depend on the server's permissions, but I just checked it on my network and it forwarded the CUPS admin pages correctly. The cups log verified that the access appeared to come from the server's localhost instead of my client, and just to verify, it did not require any root privileges or changes made to the server, I left it as-is.

    The idea is to invoke ssh in a way as to fake that the server's CUPS is on your machine. It will require that your local CUPS server is shut down first. Then in a local terminal

    ssh -L 631:server.edu:631 server.edu

    It will open an ssh tunnel and ask your password as usual, and you'll have the remote user prompt as normal. However, now you have a localhost:631 port, that when you access it, should transparently appear as server.edu's 631 port. That means you should be able to configure and use the server's CUPS printers as if they are on your own computer. If your local client is already set up to just use the default CUPS printer, you may not need to do any further configuration. I don't know about this one, I didn't go that far.

    If the server denies the port forwarding, I'm sorry, I'm not sure your request is possible; you may just have to use a normal ssh tunnel, print to file, and the cli (I know, it sucks, but it should work).

    p.s. If this is what you meant by the port forwarding you already tried, I'm sorry for duping on you.

  6. #6
    Just Joined!
    Join Date
    Feb 2009
    Posts
    4
    I tunneled but idk how to setup the printer. I checked the printers and nothing comes up so I have to type in a URI line.

    Before when I tried to tunnel I forwarded to port 22 for SSH btw.

  7. #7
    Linux Guru
    Join Date
    Jan 2009
    Location
    Dover, NH
    Posts
    1,633
    So if you poll for a network CUPS printer on localhost , nothing comes up?

  8. #8
    Just Joined!
    Join Date
    Feb 2009
    Posts
    4
    How do I poll for a printer? I hit the refresh button, clicked "Add printer" (I think this is gnome's CUPS manager) nothing showed up.

  9. #9
    Linux Guru
    Join Date
    Jan 2009
    Location
    Dover, NH
    Posts
    1,633
    I don't have an Ubuntu desktop in front of me (my laptop is SuSE-KDE), so this is sort of from memory and sort of guessing. I apologize in advance if I get this totally wrong...

    When opened the Settings -> Printers, there was a panel to the left and options on the right. On the left expand "Remote" (or shared printers by others or something to that effect) and select CUPS. On the right, it'll ask for the host and have a poll button. Try putting localhost in the host box and pressing poll and see if any printers show up in the box below.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...