Remote Server Access (LXDE + VNC)

LXDE Desktop + VNC For Remote Server Access – Debian

LXDE Desktop is very light weight desktop environment for linux. For more information goto here. The main reason I choose this desktop environment is because of its simplicity as well as light weight desktop environment. LXDE will provide all the functionality with clean interface for remote server management.

snap
Image 1.1 – LXDE Desktop Environment
apt-get update & apt-get upgrade

Now installing few LXDE Core files and TightVNC Server

apt-get install xorg lxde-core lxde-icon-theme tightvncserver

Run TightVNC Server to create its config file

tightvncserver :1

Now it will ask you to enter a new password. Its a password for your VNC client. And again it will ask if you want to give a password for view only mode. Its up to you.

Now Kill TightVNC process

tightvncserver -kill :1

Run this command to add few extra line in xstartup files

nano  ~/.vnc/xstartup

Now add this line at the end of the file and save and exit

lxterminal & /usr/bin/lxsession -s LXDE &

Now to run TightVNC Server just run

tightvncserver :1

For Mac client : option key + k will give you option to connect to server Or use free software called Chickenvnc, For Windows client, download TightVNC Java Viewer (here). Mac / Windows user both can also try RealVNC its fast.

NoticeNote : If it didn’t ask any password use your user login password while login from client computer.
[server ip]:5901

Now it should ask you password and taadaa you are using VNC now 😀

-=-=-=[ To run tightvncserver at startup ]=-=-=-
nano /etc/init.d/tightvncserver

And copy following code and past it (download) and change root to the user account that you are using to run tightvncserver

#!/bin/sh
### BEGIN INIT INFO
# Provides: tightvncserver
# Required-Start: $local_fs
# Required-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start/stop tightvncserver
### END INIT INFO

# More details see:
# http://www.penguintutor.com/linux/tightvnc

### Customize this entry
# Set the USER variable to the name of the user to start tightvncserver under
export USER=’root
### End customization required

eval cd ~$USER

case “$1” in
start)
su $USER -c ‘/usr/bin/tightvncserver :1’
echo “Starting TightVNC server for $USER ”
;;
stop)
pkill Xtightvnc
echo “Tightvncserver stopped”
;;
*)
echo “Usage: /etc/init.d/tightvncserver {start|stop}”
exit 1
;;
esac
exit 0

After this run

sudo chmod 775 /etc/init.d/tightvncserver
update-rc.d tightvncserver defaults

Now next time you boot it will automatically runs tighvncserver

NoticeUpdate: To run application in LXDE as startup app, copy your application.desktop file (usually its in your desktop, otherwise make one by going to menu and right click on application and “add to desktop”) to [user]/.config/autostart
Tunnelling through SSH (make sure tunneling is allowed in ssh config)
ssh -l user -p [ssh port usually 22] -L5901:localhost:5901 serverIp
Example (in client terminal) : ssh -l root -p 22 -L5901:localhost:5901 10.10.0.1
goto vnc client and put localhost:5901
End of LXDE Desktop + VNC For Remote Server Access – Debian


Advertisements

18 thoughts on “Remote Server Access (LXDE + VNC)

  1. Pingback: Openmediavault + Deluge 1.3.6 | Linux+

  2. Pingback: Installing ROS and Opencv on Ubuntu ARM 12.10 with LXDE, on a BeagleBoneBlack, and configuring SSH and TightVNC | eigendreams

  3. Excellent tutorial which got me tightvncserver up and running 🙂 Thank you.
    Just two things:
    The above published code section to run tightvncserver at startup:

    ### End customization requiredeval cd ~$USERcase “$1″ in
    start)

    seems to miss some line breaks. iI should be:

    ### End customization required

    eval cd ~$USER
    case “$1″ in
    start)

    It results in an error. Using the download version of the script, it is all fine.

    Then, perhaps a silly question of mine but, how do I logout of a vnc session in OMV? I mean really terminate the session and not ceasing to view it? When I press the logout button in the LXDE desktop, the LXTerminal appears. There I issue lxsession-logout and the I receive an error:
    Xlib: extension “RANDR” missing on display “:1.0”.
    Error: LXSession is not running.
    As I mentioned , perhaps I am doing something wrong. What is the correct way to logout of the vnc session?

    • shit… 😦 I don’t have options with theme to write code properly so I have to use css to make it look like code and fix space too.. that is why I have uploaded file in dropbox just in case.. anyway thanks for reply I will fix it now.. 😀

      To kill tightvncserver (or stop vnc view 😀 ) run this command

      /etc/init.d/tightvncserver stop

      and to start again

      /etc/init.d/tightvncserver start
      • Thanks for the quick reply. I tried the suggested commands and yes, the thightvncserver process is terminated from within the vnc session in the LXTerminal. Though, I am looking for a way just to logout of the LXDE desktop with something like lxsession-logout but keeping the tightvncserver alive. However, as I stated before, maybe I misunderstood something how it works with vnc sessions.

      • your sessions is password lock so if someone want to login in to vnc then they need password…. 🙂 just have strong password and when you are done .. close your vnc client.. PS. I think to logout you need to install apps like lightdm but I am not sure why you want to do that (logout?)

  4. Pingback: Tightvnc Server + jDownloader in Openmediavault | Linux+

  5. Thanks for posting a well thought out solution. This helped me sort out a PIA install of VNC server. I use VNC instead of nohup sometimes so I don’t have to remember where I put that putty window 😉

  6. Thank you for posting!
    Hello I tried this but I get syntax error :17 “)” and it dosnt seem to start at boot.
    What do I do wrong?

    Can I use the user root or do I have to use another user?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s