Updated : Feb 21, 2013 in Linux

Installing Linux Remote Terminal using VNC on a Debian Server

Here are the instructions on how to install an efficient Linux remote desktop (XCFE) using VNC.
apt-get install xorg xfce4 xfce4-goodies vnc4server

Note: If you want to change the initial VNC port edit the file: /usr/bin/vnc4server
and change the port as follows: eg. to change the vnc ports to start at 8081
'$vncPort = 8080 + $displayNumber;

Create the control file (~/.vnc/xstartup) as follows and add the following content:
touch ~/.vnc/xstartup
chmod 755 ~/.vnc/xstartup

Content:
#!/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 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
x-window-manager &
exec ck-launch-session startxfce4 &

Create the files:
touch /usr/local/bin/start_VNC
touch /usr/local/bin/stop_VNC
chmod 755 /usr/local/bin/start_VNC
chmod 755 /usr/local/bin/stop_VNC

start_VNC Content:
#!/bin/bash
vnc4server -geometry 1440x1028 -depth 24 -name connect

stop_VNC Content:
#!/bin/bash
vnc4server -kill :1

Note: Make sure you are opening the VNC port in Firewall. eg. 8081

Start the VNC server for the first time:
start_VNC
Note: You will be asked for a password. Enter here the password that the client will need to enter to get access to the VNC desktop.
IMPORTANT: Unfortunately the password is limited to 8 Chars and doesn’t accept any special chars. So just plain characters and numbers in the password. That is the reason to I recommend to stop the VNC server after use.

On client desktop:
vncclient my.server.com:8081

One of the best is TightVNC client but others will also do well.

1 Comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: