Cun Zhang’s Blog

November 6, 2008

VNC use SSH tunnel on Debian

Filed under: Linux — Tags: , , — Cun Zhang @ 19:07
  1. Install SSH server and VNC server:

    apt-get install ssh vnc4server

  2. SSH server configuration
    See My past post SSH login without password
  3. VNC server configuration
    cunzhang@node31:~$ cat .vnc/xstartup

    #!/bin/sh# Uncomment the following two lines for normal desktop:
    # unset SESSION_MANAGER
    # exec /etc/X11/xinit/xinitrc[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
    [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
    xsetroot -solid grey
    vncconfig -iconic &
    x-terminal-emulator -geometry 80×24+10+10 -ls -title “$VNCDESKTOP Desktop” &
    #x-window-manager &
    xfce4-session&

    cunzhang@node31:~$ cat /etc/xinetd.d/xvncserver

    service vnc-1024×768x24
    {
    protocal = tcp
    socket_type = stream
    wait = no
    user = nobody
    servr = /usr/bin/Xvnc
    server_args = -inetd -query localhost -localhost -once -geometry 102×768 -depth 24
    port = 5901
    }

  4. SSH client Installation and configuration
    I use Windows and OpenSSH. Download OpenSSH and install the client.And download the pub key from the remote server.
  5. VNC viewer Installation
    I use TightVNC viewer.Install it with the default cofiguration.
  6. Create a batch file to use SSH  tunnel to connect the server.

    ssh -l cunzhang 192.168.1.1 vnc4server :1 -localhost
    ssh -l cunzhang 192.168.1.1 -L 5901:127.0.0.1:5901
    ssh -l cunzhang 192.168.1.1 vnc4server -kill :1

  7. Run This batch file and open the TightVNC viewer, input 127.0.0.1:1,then input password.

Now You’r working in the remote desktop.
Reference:

  1. http://osric-life.blogspot.com/2007/09/vnc-server-on-debian.html
  2. http://hi.baidu.com/tekjian/blog/item/fe0955ec1a2b28d2b21cb179.html

1 Comment »

  1. Nice theme,I love it so much.

    Comment by Ed — December 20, 2008 @ 23:24

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress