ssh -R from work to home and ssh from home to work

Discussion in 'Linux Networking' started by Sean, Oct 4, 2003.

  1. Sean

    Sean Guest

    While I am at work I run:

    ssh -R 5022:localhost:22 [email protected] -c blowfish

    While I am at home I run:

    ssh -X -p 5022 [email protected] -C -c blowfish

    So I am now working from home. The problem is that $DISPLAY is not
    set. This doesn't pose a problem yet because X forwarding is still
    sending Xwindows to my home display. The issue is: after I ssh to
    work and then ssh to another network server the $DISPLAY variable is
    set to the display of the original machine I ssh'd to and Xwindows are
    now sent to it rather than home.

    I don't know why $DISPLAY is not set on the original ssh but all I
    want is for the windows from the second ssh'd to server to end up at
    home. Is the first problem the cause of the second? More
    importantly, how do I solve the second problem.

    Thanks for any help.
    Sean
     
    Sean, Oct 4, 2003
    #1
    1. Advertisements

  2. Sean

    Bit Twister Guest

    for starters do a man ssh and try -X on each ssh.
     
    Bit Twister, Oct 4, 2003
    #2
    1. Advertisements

  3. Sean

    Sean Guest

    While I am at work I run:
    First of all thanks for responding.

    So, I tried:
    While I am at work I run:
    ssh -X -R 5022:localhost:22 [email protected] -c blowfish
    While I am at home I run:
    ssh -X -p 5022 [email protected] -C -c blowfish

    And still, after I ssh from home to work:
    prompt> echo $DISPLAY
    DISYLAY: Undefined variable.
     
    Sean, Oct 4, 2003
    #3
  4. Sean

    Bit Twister Guest

    Ok, I'll guess work's sshd config file has been set to not forward
    the display variable.
     
    Bit Twister, Oct 4, 2003
    #4
  5. I don't think you should use the -X from work to home (if it is not your
    intent to display X at work). Do you do ssh to the tunnel from an xterm
    at home? However, I think the problem is that the ssh to the tunnel makes
    you appear for all intents and purposes to be on localhost on the other
    end of the tunnel, so that might be where an X program might try to
    display (if there was an X server running there). If there is no X server
    there, that might be why DISPLAY is undefined.

    For example when I stopped my local smtp, created an ssh tunnel
    25:127.0.0.1:25 to another internet host (as local root and remote normal
    user) and then sent mail as a normal user, ident in the mail headers
    showed that the connection was from [email protected], but I was definitely
    not root at that localhost (not sure if that was because sshd was running
    as root or because the tunnel was initiated as my root). But from the
    point of view on the remote, the mail appeared to come from its localhost.

    So you might need to purposely tunnel X back from some port on the remote
    localhost back to your localhost (with -R switch so remote localhost could
    connect to it). For example, you might try using -R 6010:127.0.0.1:6000
    and not -X, and then set DISPLAY on remote to localhost:10.0 (kind of like
    X11Forward normally does).
     
    David Efflandt, Oct 5, 2003
    #5
  6. Sean

    Sean Guest

    You are right. I have since solved the problem.

    Thanks
     
    Sean, Oct 5, 2003
    #6
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.