Table of Contents

SSH from Powershell

In current versions of Windows, ssh is available from within Powershell. In that case, you do not need a separate ssh client. This will work more or less the same as ssh from Linux and MacOS.

Also see: SSH tips and tricks

Putty

Putty is a graphical frontend for SSH, available for Windows and Linux. On Linux, it doesn't offer much in addition to the command line ssh program.

Connection setup

SSH tunnels

Tunneling X-Windows over ssh using PuTTY

Our firewall prohibits direct X-Windows connection between outside and inside machines. Normally, when using ssh from a Unix machine (outside) to a local Linux box (inside) will automatically setup X11-forwarding through a tunneling mechanism. This means that all local X11 requests are translated by ssh on both sides of the connection to, what is called, a tunnel in the ssh protocol. It is possible to run a similar setup when the outside machine is a Windows based OS.

Here is a quick step through to get the tunneling up and running:

1. Setup PuTTY: First, start up the program. When PuTTY first starts up, you see the sessions screen; you need to type in the information for the computer with which you wish to connect. Notice that I have typed in the hostname in the Host Name field, that I've selected the SSH protocol radio button, and that I've given the session a name that I will be saving to. However, don't save the session yet.

2. Now, so far all we've done is created a session that we could use to log in and use the shell prompt. Next we need to tell PuTTY how we want to tunnel. On the left, under “Category”, you'll see “Tunnels” as the second from the bottom. Click on it. Then, on the right at the bottom, you'll see the “Source Port” text box. Here you will input the port that you wish to tunnel. Normally you are using display number :0 on you local machine, but we are going to use another display number as :0 is usually not available for tunneling. Most of the time you are using display number :1, so you put in the number 5901 (other display numbers :N correspond to porrt number 590N). Finally, in the “Destination” text box below that, you'll put where that port should be forwarded. Since the “Destination” box is from the point of view of the computer you're connecting to, you have to put can put there any inside machine that has X11 access, then a colon “:”, then the port, i.e. “hostname.strw.leidenuniv.nl:5901” without the quotes.

3. Click the “Add” button, and you should see the new tunnel “L5901 hostname.strw.leidenuniv.nl:5901” in the “Forwarded Ports:” box.

4. All you have to do is click on “Session” at the top left of the “Category:” box, then click on the “Save” button, and you have a saved session!

5. To use this tunnel, log into your machine with Putty. Once logged in you need to start a vncserver on the remote machine. It will respond with the display number: Verify that this display number corresponds with the one use have defined in the tunnel. If not, go back to 2. and add the correct tunnel. Leave the putty ssh session on.

6. Then, bring up your VNC viewer and, for the VNC server that you want to connect to, type “localhost:port”, where “port” is the port you're forwarding. In this case, it's “localhost:5901”. It will ask you for the password you have given in section 5. while starting the vncserver.

7. You will be presented with a login screen to the graphical enviroment of hostname. Login with yous STRW username and password combination.

End the Tunnel

After you are done, exit from the graphical enviroment by logging out from hostname and closing the associated window. This will end the vnc viewer.

Nou you are still left wit the open putty ssh session and its tunnel. But on the hostname the vncserver is still running, so we need to close that too. Type on the unix prompt : vncserver -kill :1 or whatever port number you have been assigned previously. This will end the vncserver session and now you are ready to logout the putty session by typing on the unix command: exit.

See also