Differences between revisions 32 and 33
Revision 32 as of 2016-11-18 09:28:22
Size: 5853
Editor: gfreudig
Comment:
Revision 33 as of 2016-11-18 09:42:32
Size: 6920
Editor: gfreudig
Comment:
Deletions are marked like this. Additions are marked like this.
Line 21: Line 21:
If the .vnc subdirectory in your home does not exist in your home it is created at startup and you will be asked to define a password for accessing your server and another one for just observing without interacting. Also created is a default xstartup script which is executed by the vncserver:
{{{
#!/bin/sh
xrdb $HOME/.Xresources
xsetroot -solid grey
export XKL_XMODMAP_DISABLE=1

# select desktop to use

/etc/X11/Xsession # starts default desktop on target machine

# to select a specific desktop activate one of the desktops stated below
# and comment out the line above with /etc/X11/Xsession
 
#/usr/bin/gnome-session
#/usr/bin/gnome-session-classic
#/usr/bin/startkde
#/usr/bin/startxfce4
#/usr/bin/startfluxbox

# Automatically end the server process after desktop session logout
vncserver -kill $DISPLAY
}}}
You can edit the xstartup file to switch to your favorite desktop. The "vncserver -kill" command in the last line stops your vncserver after a logout in the remote desktop session.
Line 27: Line 52:

== Connecting the vncviewer ==

What is VNC?

VNC (Virtual Network Computing) is a remote desktop software for linux. It can be used for a single graphical application or for a full desktop session. Client and server interact over the Remote Framebuffer (RFB) Protocol. Technically the vncserver process on the target machine is an X-Server with a virtual display attached to it. The vncviewer on the client shows the content of this virtual display in his own window and transfers keyboard and mouse events to the vncserver.

How do I use VNC?

Starting the vncserver

ssh to the target machine and start a vncserver:

pmuster@colombo07:~$ 
pmuster@colombo07:~$ vncserver

New 'colombo07:7 (pmuster)' desktop is colombo07:7

Starting applications specified in /home/pmuster/.vnc/xstartup
Log file is /home/pmuster/.vnc/colombo07:7.log

pmuster@colobo07:~$

In the output of the command the number after the colon of the hostname (colomb07:7) is the virtual display number of your vncserver. You need this number to connect your vncviewer to the correct listening port of your vncserver.

If the .vnc subdirectory in your home does not exist in your home it is created at startup and you will be asked to define a password for accessing your server and another one for just observing without interacting. Also created is a default xstartup script which is executed by the vncserver:

xrdb $HOME/.Xresources
xsetroot -solid grey
export XKL_XMODMAP_DISABLE=1

# select desktop to use

/etc/X11/Xsession        # starts default desktop on target machine

# to select a specific desktop  activate one of the desktops stated below
# and comment out the line above with /etc/X11/Xsession
 
#/usr/bin/gnome-session
#/usr/bin/gnome-session-classic
#/usr/bin/startkde
#/usr/bin/startxfce4
#/usr/bin/startfluxbox

# Automatically end the server process after desktop session logout 
vncserver -kill $DISPLAY

You can edit the xstartup file to switch to your favorite desktop. The "vncserver -kill" command in the last line stops your vncserver after a logout in the remote desktop session.

VNC inside the ETH network

Start a vnc-server on the machine you want to control, with vncserver :1 (:1 means display, resp. port 1). You will be asked to define a password for accessing your server and another one for just observing without interacting. After that, your server is up and running and you can connect to it with any available VNC-clients (e.g. TightVNC) by entering the hostname you want to connect to, like hostname:1.

VNC access from the internet

Due to security reasons the listening port of the vnc server is not directly reachable from a client in the internet. There are two possibilities to perform a vnc session to an ETH network internal host from the internet :

  • Use the Cisco SSL-VPN client software of ID and connect the SSL-VPN adapter before starting the VNC viewer programm
  • Access the VNC-server through an SSH-tunnel

Connecting the vncviewer

VNC through SSH tunnel with Linux

  1. Start VNC Server on remote host with the option -localhost
      $ ssh <remoteHost>                          // where <remoteHost> is the machine on which the application you want to start runs
      $ vncserver :<display#> -localhost          // where <display#> is a number between 1 and 99

    Attention! Always choose a strong password when starting vncserver. Otherwise, you'll make it trivial for intruders to hijack your account!

  2. Start VNC viewer on your machine (Linux)
      $ vncviewer -via <remotehost>.ee.ethz.ch localhost:<display#>
    Mac users may establish the tunnel via SSH, then use "open vnc://localhost:PORT" to use the built-in VNC client.

VNC through SSH tunnel with Windows

  1. Start VNC viewer on your machine (Windows with TightVNC and putty)

    Putty is the most popular free ssh client software on Windows. When you have configured a normal ssh session to the vnc server machine you can configure additional port forwards on the established ssh-connection. A tunnel configuration needs a local listening port and a destination on ssh server side.The destination could be localhost or another machine reachable by the ssh server machine.

    The following screeshots show how to configure an additional tunnel for connecting the local vnc-server on port 5901 of the ssh server machine:

    vnc1.jpg

    After clicking the "Add"-Button the putty window changes to:

    vnc2.jpg

    Don't forget to save the session if you want this tunnel to be permanently configured in this session.

    Now you can connect your vnc viewer programm to the configured listening port of the putty client on the client machine:

    vnc3.jpg

Ending a VNC Session

/!\ Warning! Do not log out via the logout menu of the Operating System within the VNC session!
This causes a dead VNC connection. Dead means, you can't connect to that display anymore, which results in an unusuable, ressource consuming VNC server process on the host side.

  1. Finally, after you have closed the VNC-Window on your machine, it's important to end the vnc process on the remote host to avoid unused processes:

      $ ssh <remoteHost>
      $ vncserver -kill :<display#>
    Or You add the 'vncserver -kill' command directly in your 'xstartup' script as shown in 'Troubleshooting' Pt.2 below.

Troubleshooting

  1. If you are using gnome as default desktop environment and are affected by completely wrong keyboard-layout after logon to gnome (http://bugs.debian.org/476727) use the following workaround:

    Directly in the line before /etc/X11/Xsession of $HOME/.vnc/xstartup add the line

      export XKL_XMODMAP_DISABLE=1
  2. If you still want to use gnome2 or xfce instead of gnome3 change following:
    •    #!/bin/sh
      
          xrdb $HOME/.Xresources
          xsetroot -solid grey
          export XKL_XMODMAP_DISABLE=1
          /usr/bin/gnome-session-fallback
         #/etc/X11/Xsession
         #/usr/bin/wmaker
         #/usr/bin/startkde
      
         # Automatically end the server process after leaving
          vncserver -kill $DISPLAY
      In this case with gnome-session-falllback please make sure to check next point with the keyboard changes. Point 3
  3. If you are using gnome as default desktop environment and the up and down arrows behave wrong (http://bugs.debian.org/679543) do the following:

    • Go to: Applications->System Tools->Preferences->System Settings->Keyboard->Shortcuts->Windows

    • And disable options: "Toggle maximization state" and "Restore windows"


CategoryLXCL