Sunday, July 6, 2008

Remote Access on Linux

VNC server and vncviewers are quite popular for accessing linux desktops remotely either from a windows or a linux client. I won't discuss much about them as a lot of information is available on web about this. I would rather give links to some webpages here:


Rather than explaining things, I would just write down few commands to get you started. I am assuming you are using Debian Etch 4.0.

$ sudo apt-get install vncserver
$ vncserver :1 -geometry 1024x768 -depth 24 -pixelformat rgb565

It might ask you to enter a password to be used by users to connect your system through vnc.
The first time vncserver is started up, it will also create a configuration file, in your home directory, called $HOME/.vnc/xstartup. Execute the follow to stop vncserver.

$ vncserver -kill :1


On your client,

$ vncviewer :1


Best part is you can connect to a vncserver through an SSH tunnel using -via option with vncviewer. But install tightvncserver on the host machine. In order to use ssh tunnel, you need to provide username and password for ssh login. so the first password is for ssh login while the second password is for vncserver available in ~/.vnc/passwd. -Fullcolor option gives best display property for your vnc session.

[control@cube:]$ vncviewer -via swg@172.28.52.111 -Fullcolor insane:1

VNC Viewer Free Edition 4.1.1 for X - built Feb 26 2007 20:38:07
Copyright (C) 2002-2005 RealVNC Ltd.
See http://www.realvnc.com for information on VNC.
swg@172.28.52.111's password: ***

Sun Apr 27 12:24:43 2008
CConn: connected to host localhost port 5599
CConnection: Server supports RFB protocol version 3.3
CConnection: Using RFB protocol version 3.3
Password: ***

Sun Apr 27 12:24:45 2008
TXImage: Using default colormap and visual, TrueColor, depth 24.
CConn: Using pixel format depth 24 (32bpp) little-endian rgb888
CConn: Using ZRLE encoding

Sun Apr 27 12:24:52 2008
CConn: Throughput 20000 kbit/s - changing to hextile encoding
CConn: Using hextile encoding


Connecting a Linux server from a windows client

There are two ways we can connect a linux machine from windows:

1. Using Putty to establish a ssh connection and exporting display using xmanager

2. Using VNC client to connect to vnc server running on linux machine.


I would describe both the methods as neatly as possible.

Putty+ Xmanager

1. Download "Xmanager" from this site.

http://www.netsarang.com/download/down_xme2.html

2. Install the Xmanager Enterprise 2.1 Build 0038 . In the serial
field type "evaluation".

3. Once installation is over, go to start -> all programs -> Xmanager
Enterprise -> xmanager-passive

4. Now run "putty.exe". Enter the IP of the ssh server you want to
connect. Click on connection -> ssh -> x11 on the left hand side bar
and on the right hand side click on "Enable X11 forwarding".


5. Now login to your ssh server and run any gui application.



VNC Server - client

1. Download realvnc viewer from this site. It would ask you to enter
user info. Don't enter anything and click on "proceed to download".

http://www.realvnc.com/products/free/4.1/winvncviewer.html

2. Download the following exe file and NOT the zipped one and put it on desktop.

VNC Free Edition Viewer for Windows
Stand-alone Viewer
Version 4.1.2

3. Double click on it. It would ask for Server. Enter following

your_vnc_server:1

4. Then it will ask for password only. Now enter the password provided to you.


5. Enter the password and you can the linux desktop.

Caution: First try to connect the vncserver from a linux desktop and make sure that it is working. Then only try from a windows machine.