Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
en:documentation:tutorials:ssh:putty [2020/06/11 10:06] – [3.5 Configuring the PuTTY proxy (plink)] links ltaulellen:documentation:tutorials:ssh:putty [2023/12/12 12:58] (Version actuelle) – supprimée ltaulell
Ligne 1: Ligne 1:
-====== 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). 
- 
-<note warning>If you are using **Windows 10**, please refer to [[documentation:tutorials:ssh:windows10|this documentation]]</note> 
- 
-===== References ===== 
- 
-  * http://marc.terrier.free.fr/docputty/index.html (French translation of PuTTY's official documentation) 
-  * http://the.earth.li/~sgtatham/putty/0.62/htmldoc/ (Official documentation of PuTTY) 
-  * http://fixunix.com/ssh/74073-putty-proxycommand.html#post242591 
-  * http://blog.mazenod.fr/2010/09/quitter-putty-pour-kitty/ 
-  * http://www.9bis.net/kitty/ (Official website of KiTTY) 
- 
-===== 0. Prerequisite ===== 
- 
-  * Read [[http://marc.terrier.free.fr/docputty/index.html| PuTTY documentation ]]. 
-  * For the PSMN, **have logged in, at least once**, from a real operating system (Linux/BSD/Mac OSX) : [[http://www.ens-lyon.fr/PSMN/doku.php?id=documentation:tutorials:ssh:first_connection| First Connection to the PSMN ]] 
-<hidden> 
-[[https://www.psmn.ens-lyon.fr/tikiwiki4/tiki-index.php?page=A+la+premi%C3%A8re+connexion&bl=n|First Connection to the PSMN]]. 
-</hidden> 
- 
-<note warning>**The use of Windows for connection and access to PSMN resources is strongly discouraged.**</note> 
-===== 1. Installing ===== 
- 
-Please install (or have your administrator install) the following softwares [[http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html|PuTTY]] (or [[http://www.9bis.net/kitty/|KiTTY]]) and [[http://winscp.net/eng/download.php|WinSCP]]. 
- 
-{{:documentation:tutorials:menu_xp.png?direct&200|Menu}} 
- 
-===== 2. Create a key ===== 
- 
-Start the program ''PuTTYgen''. Check in the ''Key'' menu that you are using SSH-2 **at minimum**. 
-{{:documentation:tutorials:putty_keygen_1.png?direct&300 |}} 
-Then click on ''Generate''. When your key is generated, add a ''passphrase''. It must contain **at least 15 characters**. 
- 
-That's a **bad passphrase.** : 
-<code> 
-toto 
-</code> 
- 
-This is a **good passphrase.** : 
-<code> 
-H3re is an ex4mple of @ compl1cated, ev3n c0nvoluted passphr4se. 
-</code> 
- 
-This is also a **good passphrase.** : 
-<code> 
-A bottle of "Glenfîddich Rare Collection 1937" is worth 15,000 euros including tax. Minimum... 
-</code> 
- 
-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 !** 
- 
-{{:documentation:tutorials:putty_keygen_2.png?direct&300|}} 
- 
-<WRAP center round important 60%> 
-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. 
-</WRAP> 
- 
- 
- 
- 
- 
-===== 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''. 
-{{:documentation:tutorials:putty_conf_session.png?direct&300|}} 
- 
-  * In ''Terminal->Keyboard'', choose ''Linux''. 
-{{:documentation:tutorials:putty_conf_term_keyb.png?direct&300|}} 
- 
-  * In Windows->Translation, choose UTF-8 or ISO-8859-15. It is necessary to test, it depends on your version of Windows. 
-{{:documentation:tutorials:putty_conf_win_trans_a.png?direct&300|}} {{:documentation:tutorials:putty_conf_win_trans_b.png?direct&300|}} 
- 
-  * In ''Windows->Selection'', choose ''xterm''. 
-{{:documentation:tutorials:putty_conf_win_selection.png?direct&300|}} 
- 
-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. 
-{{:documentation:tutorials:putty_conf_conn_data.png?direct&300|}} 
- 
-  * In ''Connection->Proxy'', check that none is configured. 
-{{:documentation:tutorials:putty_conf_conn_proxy_none.png?direct&300|}} 
- 
-  * In ''Connection->SSH->Auth'', activate the forwarding agent. 
-{{:documentation:tutorials:putty_conf_conn_ssh_auth.png?direct&300|}} 
- 
-  * In ''Connection->SSH->X11'', activate X11 forwarding. 
-{{:documentation:tutorials:putty_conf_conn_ssh_x11.png?direct&300|}} 
- 
-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. 
-{{:documentation:tutorials:putty_alert_hostkey.png?direct&300|}} 
- 
-  * Enter your SNS, CBP or NCSP password when prompted. 
- 
-  * The PSMN Gateway has very few tools at its disposal. Connect to an internal machine: ([[documentation:clusters:services#serveurs_de_compilation|See the list of compilation servers]]. Accept the addition of the HostKey to the SSH cache), then edit the file ''~/.ssh/authorized_keys''. 
-{{:documentation:tutorials:ssh_vim_authorized_keys.png?direct&300|}} 
- 
-// With vim,// ''i'' // to switch to "insert" mode,// ''Esc'' // to return to normal mode,// '':wq'' // to enter command mode (**:**), save (**w**rite) and exit (**q**uit).// 
- 
-  * copy/paste (Select, Ctrl+c, middle-click) your **public SSH** key in the file ''~/.ssh/authorized_keys''. 
-{{:documentation:tutorials:win_copy_paste_authkeys.png?direct&300|}} 
- 
-// With vim,// ''i'' // to switch to "insert" mode,// ''Esc'' // to return to normal mode,// '':wq'' // to enter command mode (**:**), save (**w**rite) and exit (**q**uit).// 
- 
-  * 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''. 
-{{:documentation:tutorials:pagent_menu.png?direct&|}} 
- 
-  * Choose your private key (ppk file). 
-{{:documentation:tutorials:pagent_selectkey.png?direct&300|}} 
- 
-  * Enter the passphrase of your private key to unlock it. 
-{{:documentation:tutorials:pagent_passphrase.png?direct&|}} 
- 
-  * Your key is loaded, and visible in the list. 
-{{:documentation:tutorials:pagent_keylist.png?direct&300|}} 
- 
-==== 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''. 
-{{:documentation:tutorials:putty_conf_session.png?direct&300|}} 
- 
-  * This is the desired result. : 
-{{:documentation:tutorials:putty_normal_session.png?direct&300|}} 
- 
- 
-==== 3.5 Configuring the PuTTY proxy (plink) ==== 
- 
-<note important> 
-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).</note> 
- 
-PuTTY's proxy allows ssh bounces, through several machines  
-({{:documentation:tutorials:diagramme_ssh_putty.png?linkonly|voir infographie}}). 
- 
-__Légende :__ 
-  * **black** : physical connection 
-  * <wrap round notice>blue</wrap> : standard ssh connection 
-  * <wrap round danger>red</wrap> : virtual ssh connection (bounce) 
-  * <wrap round safety>green</wrap> : NFS link (/home) 
- 
-{{:documentation:tutorials:diagramme_ssh_putty.png?direct&800| }} 
- 
-In the following, we consider that your private key is loaded by ''pageant'' ([[documentation:tutorials:ssh:putty#chargement_de_la_clef_dans_pageant_putty_agent|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) 
- 
-{{:documentation:tutorials:putty_conf_session_x5770.png?direct&300|}}. 
- 
-  * In ''Connection->Proxy'', select ''Local''. 
-  * In ''Connection->Proxy'', set "Telnet command" as follows : <code>plink.exe -load allo-psmn -nc %host:%port</code> 
- 
-{{:documentation:tutorials:putty_conf_conn_proxy_x5770.png?direct&300|}} 
- 
-  * 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 === 
- 
-<note important>**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"</note> 
- 
-<note important> 
-If you do not have an ENS account, replace **ssh.ens-lyon.fr** by **ssh.psmn.ens-lyon.fr** in the following documentation. 
-</note> 
- 
-  * 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. 
- 
-{{:documentation:tutorials:putty_conf_session_ext.png?direct&300|}} 
- 
-  * Return to the gateway session (allo-psmn, Load) 
- 
-  * In ''Connection->Proxy'', select ''Local''. 
-  * In ''Connection->Proxy'', set ''Telnet command'' as follows : <code>plink.exe -load ssh.ens -nc %host:%port</code> or <code>plink.exe -load ssh.psmn -nc %host:%port</code> 
- 
-{{:documentation:tutorials:putty_conf_conn_proxy_ext.png?direct&300|}} 
- 
-  * Go back to "Session", save. 
-  * Load the Lyon ENS gateway session (ssh.ens, Load) 
-  * Click on ''Open''. **Reproduce the steps of the [[en:documentation:tutorials:ssh:putty#first_connection|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 [[en:documentation:tutorials:ssh:putty&#case_1you_are_inside_the_ens_networks|Case 1 above]]. 
- 
- 
-===== 4. WinSCP ===== 
- 
-The WinSCP software is used to copy files, using the SSH protocol (and PuTTY sessions). 
- 
-<note important>**This documentation assumes that your client workstation is within the School's network.**</note> 
- 
- 
- 
- 
- 
-==== 4.1 Configuration, Import & Connexion ==== 
- 
-  * In WinSCP, at the first launch, click on ''Tools->Import''. : 
-{{:documentation:tutorials:winscp_sessions_import_a.png?direct&300|}} 
- 
-  * Select all your PuTTY sessions, **including allo-psmn**, check the box "import host keys...", Validate. 
-{{:documentation:tutorials:winscp_sessions_import_b.png?direct&300|}} 
- 
-  * If you forgot to import HostKeys, you will get this message : 
-{{:documentation:tutorials:winscp_hostkey.png?direct&300|}} 
- 
-  * Select one of the sessions, then click on ''Connect''. 
- 
-  * Finally, after logging in, you will get this panel: 
-{{:documentation:tutorials:winscp_panels.png?direct&300|}} 
- 
-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". [[http://sourceforge.net/projects/xming/|Xming]] 
- 
-The PSMN has a machine dedicated to graphic visualization, see [[documentation:tutorials:visualisation|this documentation]] for his use. 
en/documentation/tutorials/ssh/putty.1591869993.txt.gz · Dernière modification : 2020/08/25 15:58 (modification externe)