Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question

4 Answers 4

up vote 2 down vote accepted

I have this in bin/startvnc in my machines:

x11vnc -display :0 -localhost -nopw -clear_mods

If the box has other users on it remove the -nopw if you are paranoid about security.

I login with something like this:

ssh -C -L 5904:localhost:5900 box

and then run startvnc

then on my local machine run

xvncviewer 0:1

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,

share|improve this answer
    
Thanks Justin. "$ x11vnc -display :0 -nopw -clear_mods" at remote host after installing x11vnc and "$ vncviewer -compresslevel 9 -depth 24 -nocursorshape -quality 5 xxx.xxx.xxx.xxx" did the trick. I didn't use ssh because both hosts are running over a VPN where only trusted hosts have valid certificates (I hope :D) –  Humber Jan 7 '10 at 18:01

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.

share|improve this answer
    
what? x11vnc does not need to run as root. –  Justin Jan 7 '10 at 2:47

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")

share|improve this answer

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

  • probably you should clean up this directory before trying to use the .Xauthority file (it will be a lot of previously created auth files for former X sessions), shutting down X and then restarting it, after that, you'll find a new file, the actual authorization to the new X session recently started.

If you are using other distro, you should probably look at /var/lib/gdm, /var/lib/kdm, and similar directories.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.