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/10 15:24] flerouxen: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 & 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 NCMSP 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> 
- 
-  * Copiez la session de la passerelle (allo-psmn, Load, renommer en **ssh.ens** (ou **ssh.psmn**), save). Changez le ''Host Name'' pour celui de la passerelle de l'ENS de Lyon (''ssh.ens-lyon.fr'') ou du PSMN (''ssh.psmn.ens-lyon.fr''). Sauvegardez. 
- 
-{{:documentation:tutorials:putty_conf_session_ext.png?direct&300|}} 
- 
-  * Revenez dans la session de la passerelle (allo-psmn, Load) 
- 
-  * Dans ''Connection->Proxy'', sélectionnez ''Local''. 
-  * Dans ''Connection->Proxy'', réglez ''Telnet command'' ainsi : <code>plink.exe -load ssh.ens -nc %host:%port</code> ou <code>plink.exe -load ssh.psmn -nc %host:%port</code> 
- 
-{{:documentation:tutorials:putty_conf_conn_proxy_ext.png?direct&300|}} 
- 
-  * Revenez dans ''Session'', sauvegardez. 
-  * Chargez la session de la passerelle de l'ENS de Lyon (ssh.ens, Load) 
-  * Cliquez sur ''Open''. **Reproduisez les étapes du [[documentation:tutorials:ssh:putty&#premiere_connexion_sauvegarde_de_ssh_authorized_keys|paragraphe 3.2]]** directement sur la machine ''ssh.ens-lyon.fr''. 
- 
-  * Revenez dans la session de la passerelle (allo-psmn, Load), puis cliquez sur ''Open''. Vous êtes, normalement, directement connecté sur allo-psmn. 
- 
-Il est possible de faire plus d'un rebond avec Putty en rappelant à chaque fois la session précédente avec la commande plink. Vous pouvez donc vous connecter sur une machine interne directement depuis l'extérieur. Pour cela, créez une troisième connexion en suivant les étapes du [[documentation:tutorials:ssh:putty&#cas_1vous_etes_a_l_interieur_du_reseau_de_l_ens|cas 1 ci-dessus]]. 
- 
- 
-===== 4. WinSCP ===== 
- 
-Le logiciel WinSCP sert à la copie de fichiers, en utilisant le protocole SSH (et les sessions PuTTY). 
- 
-<note important>**Cette documentation part du principe que votre poste client se trouve à l'intérieur du réseau de l'École**</note> 
- 
- 
- 
- 
- 
-==== 4.1 Configuration, Import & Connexion ==== 
- 
-  * Dans WinSCP, au premier lancement, cliquez sur ''Outils->Importer'' : 
-{{:documentation:tutorials:winscp_sessions_import_a.png?direct&300|}} 
- 
-  * Selectionnez toutes vos sessions PuTTY, **y compris allo-psmn**, cochez la case "importer les clefs d'hotes...", Validez. 
-{{:documentation:tutorials:winscp_sessions_import_b.png?direct&300|}} 
- 
-  * Si vous avez oublié d'importer les HostKeys, vous aurez ce message : 
-{{:documentation:tutorials:winscp_hostkey.png?direct&300|}} 
- 
-  * Selectionnez une des sessions, puis cliquez sur ''Connecter''. 
- 
-  * Enfin, après connexion, vous obtiendrez ce panneau : 
-{{:documentation:tutorials:winscp_panels.png?direct&300|}} 
- 
-Vous pouvez maintenant copier des fichiers vers ou depuis le PSMN. 
- 
-===== 5. Export X, Xming ===== 
- 
-Si vous souhaitez afficher des applications graphiques depuis une machine du PSMN vers votre poste client sous Windows, il faut installer un ''serveur X'' : Le plus simple, fonctionnant trés bien avec PuTTY, est [[http://sourceforge.net/projects/xming/|Xming]] 
- 
-Le PSMN dispose d'une machine dédiée à la visualisation graphique, voir [[documentation:tutorials:visualisation|cette documentation]] pour son usage. 
en/documentation/tutorials/ssh/putty.1591802641.txt.gz · Dernière modification : 2020/08/25 15:58 (modification externe)