Advertisment

Win-Lin Remote Connects 

author-image
PCQ Bureau
New Update

Physical presence before a machine to copy files or to configure it, is a matter of the

past. Thanks to the many software and utilities, which allow remote login, file transfer and remote desktop access. You may have used software

that allows us to do all this on homogenous OSs but what about sitting on a Windows machine and

viewing a Linux desktop, copying files across them or a terminal login which is more secure than

using Telnet.

Advertisment

The answer lies in two pieces of software: SSH (Secure Shell) and VNC (Virtual Network Computing). An SSH package installed on Windows and

Linux machine allows us to do secure terminal login and secure file transfer. With VNC running on 



Windows and Linux, you can view Windows desktop on Linux and a Linux's X Window desktop on
Windows. 

Direct Hit!
Applies to: System administrators
USP: A one-stop article on secure terminal access, file transfer and remote desktop access between Windows and Linux
Links:

www.openssh.com, www.realvnc.com

This article takes you through installing and configuring these two packages on Windows

and Linux. Note that for this article we have used PCQLinux 2004 and a machine running Win XP

Professional. 

Advertisment

Set up SSH



For both terminal login and secure copying we need SSH installed on PCQLinux and Win XP. PCQLinux already bundles the SSH package and installs it by default. To run the SSH service (if it is not already running), you will have to issue the following command.

service sshd start

For Windows, you will need to download OpenSSH for Windows from http://sourceforge.net/project

/showfiles.php?group_id=103886&package_id=111688. Unzip the downloaded zip file and double click 



on the setupssh.exe file. Follow the onscreen instructions to install OpenSSH. Once done, open up a Command Prompt and change (cd) to the directory where you installed OpenSSH (by default it gets installed in C:\Program Files\OpenSSH, assuming that C:\ is your boot drive). Subsequently issue the following commands.

Advertisment

mkgroup -l >> etc\group



mkpasswd -l -u administrator >> etc\passwd

The second command will allow you to login as administrator through SSH. Instead of the administrator, you can opt for any other user in which case

you have to specify the Windows login name of that user, in place of administrator, in the above 



command. Next to start the SSH server, go to Control Panel>Administrative Tools>Services, right click
on 'OpenSSH Server' from the list of services and select Start. 

Terminal access



Using the ssh command you can connect from a Linux machine to a Windows machine and vice versa. OpenSSH installs the ssh command on the

Windows machine unless you have de-selected the Client component during the OpenSSH installation. If the IP address of the Linux machine

is 192.168.0.1 and that of Windows machine is 192.168.0.20, you can use the following commands for a terminal login:

Advertisment

ssh root@192.168.0.1 (from the Windows machine)



ssh administrator@192.168.0.20 (from the Linux machine)

When prompted for a password, supply the Linux machine's root password and Windows machine's administrator password, respectively.Instead of using ssh command on Windows, you can download and use Putty

(http://the.earth.li/~sgtatham/putty/latest/x86/ putty.exe) which is a graphical client. 

File transfer



The command line way of transferring files between the Windows and Linux machines is to use the 'scp'. If you want to transfer a file named foo.conf from your Windows machine to the /opt directory of the Linux machine, use the following command. 

Advertisment

scp foo.conf root@192.168.0.1:/opt

When prompted, enter the password for the Linux root user. The syntax of the above command is:

scp @:

Advertisment

To copy a file named manual.doc from the Linux machine to C:\ of Windows:

scp manual.doc administrator@192.168.0.14:/cygdrive/c/

The syntax for this is:

Advertisment

scp @:/cygdrive//

To copy a directory, say docs, instead of a file, use the -r option as:

scp -r docs root@192.168.0.1:/root



scp -r docs administrator@192.168.0.14:/cygdrive/c/

If the commands are too difficult to remember, you can use graphical utilities such as WinSCP (http://winscp.sourceforge.net) on Windows and SecPanel (www.pingx.net/secpanel/) on Linux to transfer files. 

Set up VNC



For Windows, download VNC for Windows from http://www.realvnc.com/dist/vnc-4.0x86_win32. exe. To install it, double click on the file and follow onscreen instructions. The defaults should work fine. When prompted for, enter a password. You will need to supply this password when you try to access the Windows desktop from the Linux machine. 

PCQLinux bundles along the VNC software. To install VNC, install the RPMs named vnc-server-4.0-0.beta4.3.i386.rpm and vnc-4.0-0.beta4.3.i386.rpm found on PCQLinux CD1 and CD3 respectively. 

Access Linux desktop



To access Linux desktop from Windows, you will first need to run vncserver on the PCQLinux machine. For this, login as root and issue the following.

vncserver

When prompted, enter and confirm a password. This will be the password required to access the Linux desktop from the

0Windows machine. Now hop to the Windows machine and click on Start>Programs>RealVNC>VNCViewer>Run VNC Viewer. For server, enter 192.168.0.1:1. When prompted, enter the password that you had specified for vncserver. You will be greeted by a Linux desktop. But wait, the default desktop manager shown by VNC on Linux is the same boring twm. How about showing up a ful-fledged GNOME desktop? For this, open the file named xstartup found in the directory /root/.vnc, in a Linux text editor. In this file, replace twm with gnome-session on the last line. Stop the vncserver by issuing the following command.

killall Xvnc

Then again start it by issuing vncserver. Next time when you connect from the Windows machine, you will be greeted by the PCQLinux GNOME desktop. 

Access Windows desktop



After installing VNC on Windows, you should be able to see a VNC server icon on the system tray. If not, click on Start>Programs>RealVNC>VNC Server (Service Mode)>Start VNC Service. 

On the Linux machine, switch to X Window, open a terminal window within X Window and issue the following.

vncviewer 192.168.0.20:0 

When prompted, type in the password that you had specified during the VNC installation on Windows. Windows desktop will now show on your Linux machine. 

Shekhar Govindarajan IT4Enterprise

Advertisment