Does somebody knows how to clone/connect to a running xorg server to see in soft real time what is the monitor/display showing (The display is a couple of miles away but I can reach it throw TCP/IP)? I have a small script to get a screenshot but is a bit limited.
#!/bin/bash
REMOTE_USER=root
IP=$1
IMAGE_FILE=/tmp/host_${IP}_`date +"%Y%m%d-%H:%M:%S"`.png
ssh root@$IP 'xwd -d :0 -root | gzip' | gunzip | convert - $IMAGE_FILE
I thought that it would be nice to see what the display is showing in soft real time, if possible of course. :)
Thanks in advance,
Humber
If you want to install x11vnc on the remote machine you can use it like this:
ssh remote_ip_address sudo x11vnc -auth /home/some_user/.Xauthority -display :0
Remember to have X11 Forwarding enabled in sshd.config. And you need a VNC client.
If you don't want to use VNC you can use any other program like Xnest:
Xnest -geometry 1024x768 :1& DISPLAY=:1 ssh -X gnome-session
Will need some modification for you particular case, but for someone who is using xwd it shouldn't be a problem.
I have this in bin/startvnc in my machines:
If the box has other users on it remove the
-nopw
if you are paranoid about security.I login with something like this:
and then run
startvnc
then on my local machine run
It's not as automated as a single command, but I'm always logged into a screen session anyway, so if I want to use vnc I just open a new screen window and run startvnc,
Maybe this is overkill for your particular case. But I'll post it anyway in case it's useful for other people coming to this question in the future.
Another way to attach to an X session is by setting up FreeNX on the machine that you wish to control remotely. Then on your local machine you must run the NX client, requesting a shadow session.
When the NX client connects to the remote machine, you'll be shown a list of available sessions. If you choose "X0 (Local)", you'll be able to see and control the remote display.
For more details you can take a look at Getting Started with NX (see section 4.5, "Desktop sharing and session shadowing")
Actually with some distribution like Opensuse 11.2, if you're going to use x11vnc then you're probably going to need to use an .Xauthority file created for the login manager (gdm, kdm), instead of a file created for the user itself (something like /home/user/.Xauthority or so), and you could find it in Opensuse, looking at:
/var/lib/xdm/authdir/authfiles/something-name-psedorandomly-generated
If you are using other distro, you should probably look at /var/lib/gdm, /var/lib/kdm, and similar directories.