PuTTY/KiTTY, plink & WinSCP

Configuration documentation for PuTTY/KiTTY and WinSCP in the PSMN environment (Click on the following images if you want to view them in normal resolution).

If you are using Windows 10, please refer to this documentation

References

0. Prerequisite

Cliquez pour afficher ⇲

Cliquez pour masquer ⇱

The use of Windows for connection and access to PSMN resources is strongly discouraged.

1. Installing

Please install (or have your administrator install) the following softwares PuTTY (or KiTTY) and WinSCP.

Menu

2. Create a key

Start the program PuTTYgen. Check in the Key menu that you are using SSH-2 at minimum. Then click on Generate. When your key is generated, add a passphrase. It must contain at least 15 characters.

That's a bad passphrase. :

toto

This is a good passphrase. :

H3re is an ex4mple of @ compl1cated, ev3n c0nvoluted passphr4se.

This is also a good passphrase. :

A bottle of "Glenfîddich Rare Collection 1937" is worth 15,000 euros including tax. Minimum...

Then save your private key (button Save private key, the filename does not matter, but save it with the extension .ppk). Make copies of them and hide them !

Keep the window open, and/or save the key located in the Public key for pasting… box, it's your public SSH key. Save it in an authorized_keys file.

3. PuTTY

To use key operation, you will need to log in once with a password (yours, to ENS, CBP or PSMN). To do so, you will configure a first session on PuTTY :

3.1 Configuration

  • Specify the HostName of the gateway, the port (22, default), add a session name and click Save.

  • In Terminal→Keyboard, choose Linux.

  • In Windows→Translation, choose UTF-8 or ISO-8859-15. It is necessary to test, it depends on your version of Windows.

  • In Windows→Selection, choose xterm.

under Windows Seven and/or if you have a two-button mouse, you may need to use “Compromise” instead.

  • In Connection→Data, indicate your ENS, CBP or PSMN login.

  • In Connection→Proxy, check that none is configured.

  • In Connection→SSH→Auth, activate the forwarding agent.

  • In Connection→SSH→X11, activate X11 forwarding.

Return to “Session” and save. You can now click on Open to open a connection.

Don't worry, these adjustments only have to be made once. You will then be able to copy and rename the saved sessions.

3.2 First connection

And backup of .ssh/authorized_keys

  • If necessary, validate the addition of the Gateway HostKey to PuTTY's cache.

  • Enter your SNS, CBP or NCSP password when prompted.
  • The PSMN Gateway has very few tools at its disposal. Connect to an internal machine: (See the list of compilation servers. Accept the addition of the HostKey to the SSH cache), then edit the file ~/.ssh/authorized_keys.

With vim, i to switch to “insert” mode, Esc to return to normal mode, :wq to enter command mode (:), save (write) and exit (quit).

  • copy/paste (Select, Ctrl+c, middle-click) your public SSH key in the file ~/.ssh/authorized_keys.

With vim, i to switch to “insert” mode, Esc to return to normal mode, :wq to enter command mode (:), save (write) and exit (quit).

  • You can now log out (Ctrl+d or logout)

3.3 Loading the key into Pageant (PuTTY Agent)

PuTTY Agent is used to keep a copy of your unlocked key in memory, available to software using the SSH protocol (PuTTY, WinSCP, TortoiseSVN, etc).

  • Once Pageant is started, its menu is available by right-clicking on the notification bar.
  • Choose add key.

  • Choose your private key (ppk file).

  • Enter the passphrase of your private key to unlock it.

  • Your key is loaded, and visible in the list.

3.4 Normal connection (PuTTY and Pageant)

  • Once your key is loaded into Pageant.
  • Start PuTTY, choose the previously saved session (here, allo-psmn), click on Load, then on Open.

  • This is the desired result. :

You must use a key and the PuTTY ssh-agent to be able to take advantage of the facilities of the plink proxy, this one is not interactive (it will not be able to ask for a password).

PuTTY's proxy allows ssh bounces, through several machines (voir infographie).

Légende :

  • black : physical connection
  • blue : standard ssh connection
  • red : virtual ssh connection (bounce)
  • green : NFS link (/home)

In the following, we consider that your private key is loaded by pageant (see section 3.3).

Case 1: you are inside the ENS network

  • Copy the gateway session (allo-psmn, Load, rename, save).

Change the “Host Name” to that of an internal machine of the PSMN (here, for the example, x5770comp1). So, rename the session to x5770comp1 (to follow the example)

.

  • In Connection→Proxy, select Local.
  • In Connection→Proxy, set “Telnet command” as follows :
    plink.exe -load allo-psmn -nc %host:%port

  • Return to Session, save, then click Open. You are normally directly connected to x5770comp1, without a terminal open on the gateway (allo-psmn).

Case 2: you are outside the ENS network

If you have an ENS de Lyon account, you must have activated your SSH access in the intranet. https://ent.ens-lyon.fr/ent/ Section “My Profile” → “SSH Access”
If you do not have an ENS account, replace ssh.ens-lyon.fr by ssh.psmn.ens-lyon.fr in the following documentation.
  • Copy the gateway session (allo-psmn, Load, rename to ssh.ens (or ssh.psmn), save). Change the Host Name for that of the ENS de Lyon gateway (ssh.ens-lyon.fr) or of the PSMN (ssh.psmn.ens-lyon.fr). Save.

  • Return to the gateway session (allo-psmn, Load)
  • In Connection→Proxy, select Local.
  • In Connection→Proxy, set Telnet command as follows :
    plink.exe -load ssh.ens -nc %host:%port

    or

    plink.exe -load ssh.psmn -nc %host:%port

  • Go back to “Session”, save.
  • Load the Lyon ENS gateway session (ssh.ens, Load)
  • Click on Open. Reproduce the steps of the section 3.2 directly on the ssh.ens-lyon.fr machine.
  • Return to the gateway session (allo-psmn, Load), then click Open. You are normally directly connected to allo-psmn.

It is possible to make more than one bounce with Putty by recalling the previous session each time with the plink command. So you can connect to an internal machine directly from the outside. To do this, create a third connection by following the steps of the Case 1 above.

4. WinSCP

The WinSCP software is used to copy files, using the SSH protocol (and PuTTY sessions prepared in previous paragraph).

This documentation assumes that your client workstation is within the School's network.

4.1 Configuration, Import & Connexion

  • In WinSCP, at the first launch, click on Tools→Import. :

  • Select all your PuTTY sessions, including allo-psmn, check the box “import host keys…”, Validate.

  • If you forgot to import HostKeys, you will get this message :

  • Select one of the sessions, then click on Connect.
  • Finally, after logging in, you will get this panel:

You can now copy files to or from the PSMN.

5. Export X, Xming

If you want to display graphical applications from a PSMN machine to your Windows client, you have to install an “X server”: The simplest, working very well with PuTTY, is to install an “X server”. Xming

The PSMN has a machine dedicated to graphic visualization, see this documentation for his use.

en/documentation/tutorials/ssh/putty.txt · Dernière modification: 2020/08/25 17:58 (modification externe)