User Tools

Site Tools


linux:putty

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
linux:putty [2016/04/07 08:30] jansenlinux:putty [2023/01/06 14:33] (current) – [Tunneling X-Windows over ssh using PuTTY] deul
Line 1: Line 1:
 ====== Putty ====== ====== Putty ======
-Putty is a graphical frontend for SSH, available for Windows and Linux. On Linux, it doesn't offer much in adddition to the commandline ssh program.+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 ===== ===== Connection setup =====
Line 7: Line 7:
 ===== SSH tunnels ===== ===== SSH tunnels =====
  
-===== Tunneling X-Windows over ssh using PuTTY =====+==== 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. 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.
Line 13: Line 13:
 Here is a quick step through to get the tunneling up and running:  Here is a quick step through to get the tunneling up and running: 
  
-1Setup 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.+1Setup 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
 {{ :linux:vnc1.jpg?nolink&300 |}} {{ :linux:vnc1.jpg?nolink&300 |}}
-2Now, 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, so you put 5900 here. If you were using port :1, you'd put 5901, etc. 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. Note: before you do this you must have started the vncserver on the machine you want to connect to (''hostname''). Upon start of vncserver you will be informed on which display this server will work. So when vncserver responds with hostname:1 you have to set the Destination address to: "hostname.strw.leidenuniv.nl:5901".+ 
 +3Click the "Addbuttonand you should see the new tunnel "L5901 hostname.strw.leidenuniv.nl:5901" in the "Forwarded Ports:" box. 
 {{ :linux:vnc2.jpg?nolink&300 |}} {{ :linux:vnc2.jpg?nolink&300 |}}
  
-3Click the "Addbutton, and you should see the new tunnel "L5900 hostname.strw.leidenuniv.nl:5901in the "Forwarded Ports:box.+4All you have to do is click on "Sessionat the top left of the "Category:" box, then click on the "Savebutton, and you have a saved session!
  
 {{ :linux:vnc3.jpg?nolink&300 |}} {{ :linux:vnc3.jpg?nolink&300 |}}
  
-4All 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!+5To 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: 
 +{{ :linux:putty1.png?nolink&500 |}} 
 +Verify that this display number corresponds with the one use have defined in the tunnel. If notgo back to 2. and add the correct tunnel. Leave the putty ssh session on.
  
-5. To use this tunnel, log into your machine with Putty. 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:0".+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.
  
 {{ :linux:vnc4.jpg?nolink&300 |}} {{ :linux:vnc4.jpg?nolink&300 |}}
  
-That is it!+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%%''
 + 
 +{{ :linux:putty2.png?nolink&500 |}}
  
 ==== See also ==== ==== See also ====
   * [[http://putty.org]]   * [[http://putty.org]]
 +  * [[http://realvnc.org]]
linux/putty.1460017835.txt.gz · Last modified: 2016/04/07 08:30 by jansen