OpenBSD Journal

Stupid SSH Tricks: Remote Control X11 display :0

Contributed by merdely on from the hello-computer dept.

How do you remote control the locally logged in X11 session (:0)? The standard VNC server sets up it's own display and gives you your own session on the remote box. x11vnc (in packages) allows you to remotely control the X display connected to the keyboard, monitor and mouse. Follow these steps:

  1. On the local box, install a vnc viewer: sudo pkg_add tightvnc-viewer
  2. Connect to the remote server using ssh: ssh -L 5900:localhost:5900 remotebox
  3. On the remote box, install x11vnc: sudo pkg_add x11vnc
  4. On the remote box, run x11vnc: x11vnc -display :0 -localhost
  5. On the local box, run vncviewer: vncviewer -depth 8 -encodings hextile localhost:0

What stupid tricks do you know?

(Comments are closed)


Comments
  1. By Anonymous Coward (24.37.242.64) on

    I do XDMCP with cygwin -fullscreen, -clipboard, etc. or at times XMing from my Windows box, works great (remotely, I'd tunnel over ssh) otherwise, I'm using X locally or ssh from X to my other boxes...

    Is there anything different about x11vnc vs doing XDM?

    I also run XDM on my Soekris and WRAP boxes at times, but X isn't installed on those systems, works great too for when I need a GUI for certain things.

    Comments
    1. By Mike Erdely (merdely) on http://erdelynet.com/

      > Is there anything different about x11vnc vs doing XDM?

      AFAIK, using XDM isn't giving you remote control of the active desktop. Let me give you this scenario: You leave your home computer running with a webpage displayed. You're at the office and need to see something from that webpage. ssh, x11vnc, vncviewer and you can read what's on that web page.

      It's also useful when helping someone with their computer remotely.

      Comments
      1. By Anonymous Coward (24.37.242.64) on

        > > Is there anything different about x11vnc vs doing XDM?
        >
        > AFAIK, using XDM isn't giving you remote control of the active desktop. Let me give you this scenario: You leave your home computer running with a webpage displayed. You're at the office and need to see something from that webpage. ssh, x11vnc, vncviewer and you can read what's on that web page.
        >
        > It's also useful when helping someone with their computer remotely.
        >

        Ohhhhh, nice! I have to try that.

    2. By Todd T. Fries (todd) on http://todd.fries.net/

      > I do XDMCP with cygwin -fullscreen, -clipboard, etc. or at times
      > XMing from my Windows box, works great (remotely, I'd tunnel
      > over ssh) otherwise, I'm using X locally or ssh from X to my
      > other boxes...
      >
      > Is there anything different about x11vnc vs doing XDM?
      >
      > I also run XDM on my Soekris and WRAP boxes at times, but X isn't
      > installed on those systems, works great too for when I need a
      > GUI for certain things.

      Realize that if you're using xdm/xdmcp etc across the network you're
      trusting your local network as you trust the admin(s) of your boxen.
      Your passwords and keystrokes are in the clear for any misbehaving
      box on your network to see.

      Comments
      1. By Anonymous Coward (24.37.242.64) on

        > > I do XDMCP with cygwin -fullscreen, -clipboard, etc. or at times
        > > XMing from my Windows box, works great (remotely, I'd tunnel
        > > over ssh) otherwise, I'm using X locally or ssh from X to my
        > > other boxes...
        > >
        > > Is there anything different about x11vnc vs doing XDM?
        > >
        > > I also run XDM on my Soekris and WRAP boxes at times, but X isn't
        > > installed on those systems, works great too for when I need a
        > > GUI for certain things.
        >
        > Realize that if you're using xdm/xdmcp etc across the network you're
        > trusting your local network as you trust the admin(s) of your boxen.
        > Your passwords and keystrokes are in the clear for any misbehaving
        > box on your network to see.

        True. But the only hacker internally, would be my wife as I do non-encrypted XDM/XDMCP on home LAN only, otherwise I use ssh or tunnel over ssh if at work or somewhere else. ;-)

  2. By Joshua Gimer (140.226.197.139) on

    You can use the -via switch with vncviewer to establish the ssh tunnel to the remote system for you.

    vncviewer -via user@remotebox localhost:0

    You will be prompted for the password of the user on remotebox and then the vnc password (if one is set.)

  3. By Paul 'WEiRD' de Weerd (216.239.33.25) weerd@weirdnet.nl on http://www.weirdnet.nl/

    This is a very neat trick indeed, I've used this quite often to be able to have a quick look on my workstation at the office from home.

    Perhaps someone can look at updating the x11vnc port by the way, it's pretty old (0.6.2 where current development has it at 0.9.3)

    Comments
    1. By jirib (89.176.154.98) on

      > This is a very neat trick indeed, I've used this quite often to be able to have a quick look on my workstation at the office from home.
      >
      > Perhaps someone can look at updating the x11vnc port by the way, it's pretty old (0.6.2 where current development has it at 0.9.3)

      x11vnc is ports is really old, current version has more features like ssl or java applet etc... with current feature one would not need port forwarding :)

    2. By Mike Erdely (merdely) on http://erdelynet.com/

      > Perhaps someone can look at updating the x11vnc port by the way, it's
      > pretty old (0.6.2 where current development has it at 0.9.3)

      I've started working on updating the port. On two i386 systems, though, I've had it crash X when the client disconnects with no error message. Not every time, though. This makes troubleshooting with a remote system difficult. :)

      -ME

      Comments
      1. By Anonymous Coward (24.37.242.64) on

        > > Perhaps someone can look at updating the x11vnc port by the way, it's
        > > pretty old (0.6.2 where current development has it at 0.9.3)
        >
        > I've started working on updating the port. On two i386 systems, though, I've had it crash X when the client disconnects with no error message. Not every time, though. This makes troubleshooting with a remote system difficult. :)
        >
        > -ME

        Is there a way to help test/debug with or for you on my systems? I'd be willing to help if I can...

        Comments
  4. By Anonymous Coward (121.218.48.158) on

    How about single mouse/keyboard to control a second machine?

    Install x2x on the machine you want to control, then
    on the machine with the mouse/keyboard, execute
    ssh -X <other host> x2x -west -to :0.0

    This will put the other machine on the left edge of your main machine.

  5. By Bernd Schoeller (schoelle) bernd@fams.de on

    Just as an addition to the article: http://www.karlrunge.com/x11vnc/ provides some scripts to automate the work of tunneling.

  6. By Anonymous Coward (74.216.6.17) on

    Why hextile?

Latest Articles

Credits

Copyright © - Daniel Hartmeier. All rights reserved. Articles and comments are copyright their respective authors, submission implies license to publish on this web site. Contents of the archive prior to as well as images and HTML templates were copied from the fabulous original deadly.org with Jose's and Jim's kind permission. This journal runs as CGI with httpd(8) on OpenBSD, the source code is BSD licensed. undeadly \Un*dead"ly\, a. Not subject to death; immortal. [Obs.]