Différences

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

Lien vers cette vue comparative

Prochaine révision
Révision précédente
en:documentation:tutorials:ssh:putty [2020/06/10 14:33] – créée 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 Chargement de la clef dans Pageant (PuTTY Agent) ==== 
- 
-PuTTY Agent sert à maintenir en mémoire une copie de votre clef déverrouillée, à disposition des logiciels utilisant le protocole SSH (PuTTY, WinSCP, TortoiseSVN, etc). 
- 
-  * Une fois Pageant démarré, son menu est disponible par clic-droit, sur la barre de notification. 
-  * Choisissez ''add key''. 
-{{:documentation:tutorials:pagent_menu.png?direct&|}} 
- 
-  * Choisissez votre clef privée (fichier ppk). 
-{{:documentation:tutorials:pagent_selectkey.png?direct&300|}} 
- 
-  * Entrez la passphrase de votre clef privée afin de la déverrouiller. 
-{{:documentation:tutorials:pagent_passphrase.png?direct&|}} 
- 
-  * Votre clef est chargée, et visible dans la liste. 
-{{:documentation:tutorials:pagent_keylist.png?direct&300|}} 
- 
-==== 3.4 Connexion normale (PuTTY et Pageant) ==== 
- 
-  * Une fois votre clef chargée dans Pageant, 
-  * Démarrez PuTTY, choisissez la session précedemment enregistrée (ici, allo-psmn), cliquez sur ''Load'', puis sur ''Open''. 
-{{:documentation:tutorials:putty_conf_session.png?direct&300|}} 
- 
-  * Voilà le résultat souhaité. : 
-{{:documentation:tutorials:putty_normal_session.png?direct&300|}} 
- 
- 
-==== 3.5 Configurer le proxy PuTTY (plink) ==== 
- 
-<note important> 
-Vous **devez** utiliser une clef et l'agent-ssh de PuTTY pour pouvoir profiter des facilités du proxy ''plink'', celui-ci n'étant pas interactif (il ne saura pas demander de mot de passe).</note> 
- 
-Le proxy de PuTTY permet de faire des rebond ssh, à travers plusieurs machines ({{:documentation:tutorials:diagramme_ssh_putty.png?linkonly|voir infographie}}). 
- 
-__Légende :__ 
-  * **noir** : lien physique 
-  * <wrap round notice>bleu</wrap> : connexion ssh standard 
-  * <wrap round danger>rouge</wrap> : connexion ssh virtuelle (rebonds) 
-  * <wrap round safety>vert</wrap> : liaison NFS (/home) 
- 
-{{:documentation:tutorials:diagramme_ssh_putty.png?direct&800| }} 
- 
-Dans la suite, on considère que votre clef privée est chargée par ''pageant'' ([[documentation:tutorials:ssh:putty#chargement_de_la_clef_dans_pageant_putty_agent|voir paragraphe 3.3]]). 
- 
-=== Cas 1 : vous êtes à l'intérieur du réseau de l'ENS === 
- 
-  * Copiez la session de la passerelle (allo-psmn, Load, renommez, save). 
- 
-Changez le ''Host Name'' pour celui d'une machine interne du PSMN (ici, pour l'exemple, x5770comp1). Donc, renommez la session en **x5770comp1** (pour suivre l'exemple) 
- 
-{{:documentation:tutorials:putty_conf_session_x5770.png?direct&300|}}. 
- 
-  * Dans ''Connection->Proxy'', sélectionnez ''Local''. 
-  * Dans ''Connection->Proxy'', réglez ''Telnet command'' ainsi : <code>plink.exe -load allo-psmn -nc %host:%port</code> 
- 
-{{:documentation:tutorials:putty_conf_conn_proxy_x5770.png?direct&300|}} 
- 
-  * Revenez dans ''Session'', sauvegardez, puis cliquez sur ''Open''. Vous êtes, normalement, directement connecté sur x5770comp1, sans terminal ouvert sur la passerelle (allo-psmn). 
- 
-=== Cas 2 : vous êtes à l'extérieur du réseau de l'ENS === 
- 
-<note important>**Si vous disposez d'un compte ENS de Lyon, vous devez avoir activé votre accès SSH dans l'intranet**   
-[[https://ent.ens-lyon.fr/ent/]] Rubrique "Mon profil" -> "Accès SSH"</note> 
- 
-<note important> 
-Si vous ne disposez pas d'un compte ENS, remplacez **ssh.ens-lyon.fr** par **ssh.psmn.ens-lyon.fr** dans la documentation qui suit. 
-</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.