Difference between revisions of "VNC"

From Noah.org
Jump to navigationJump to search
Line 33: Line 33:
 
Fire up SSH. This command does two things. It creates a tunnel for port 5900 between the remote and local host. It also starts x11vnc on the remote host.
 
Fire up SSH. This command does two things. It creates a tunnel for port 5900 between the remote and local host. It also starts x11vnc on the remote host.
  
   ssh username@remote.example.com -L5900:localhost:5900 ‘x11vnc -auth `cat ~/.Xauth`’
+
   ssh -L 5900:localhost:5900 username@remote.example.com 'x11vnc -rfbport 5900 -display :0 -localhost'
  
 
Now fire up a vnc viewer on your local host:
 
Now fire up a vnc viewer on your local host:
  
 
   vncviewer localhost:0
 
   vncviewer localhost:0
 +
 +
Note that you have to have port 5900 available on the remote and local hosts. VNC normally defaults to 5900, but I like to explicitly set the port so that I will easily see the error if the port is already taken.
  
 
== text mode VNC ==
 
== text mode VNC ==

Revision as of 14:25, 25 April 2007


Share your X11 desktop with VNC

If you want to expose your currently running X11 session over VNC use `x11vnc`.

simple

Just run it from the command-line with no arguments and then anyone can use a vnc client to use your desktop:

 x11vnc

add a password

If you want to add a password to make it a little more secure:

 x11vnc -passwd MYPASSWORD

It has lots of options to make password connections more secure, but this works well enough for a quick and dirty session.

Keep Listening

After the first client connection has exited x11vnc will also exit. If you want to keep the server running so that you can connect multiple times then use the -forever option.

 x11vnc -forever

.x11vncrc

You can save all these options in a dotfile called .x11vncrc:

 forever # keep listening for new connections after a client disconnects.

SSH Tunneling

Say you want to see the X11 desktop of a remote machine. Fire up SSH. This command does two things. It creates a tunnel for port 5900 between the remote and local host. It also starts x11vnc on the remote host.

 ssh -L 5900:localhost:5900 username@remote.example.com 'x11vnc -rfbport 5900 -display :0 -localhost'

Now fire up a vnc viewer on your local host:

 vncviewer localhost:0

Note that you have to have port 5900 available on the remote and local hosts. VNC normally defaults to 5900, but I like to explicitly set the port so that I will easily see the error if the port is already taken.

text mode VNC

Use linuxvnc to expose a text terminal to VNC clients. See also vncommand.

Errors

channel 2: open failed: connect failed: Connection timed out