User Tools

Site Tools


other:ssh

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
other:ssh [2020/07/08 21:56]
jypeter [Configuration files]
other:ssh [2020/07/10 07:51]
jypeter Improved the mentions of Putty
Line 27: Line 27:
  
 <WRAP center round tip 60%> <WRAP center round tip 60%>
-Note: the following will work in a **Linux** terminal, but can also work in a //​terminal//​ on a **Mac** or on a **Windows 10** computer (''​ssh''​ is directly available in ''​Windows Powershell'',​ ''​Windows Terminal''​ or the old ''​cmd'',​ but it is not the best way to use ''​ssh''​ on Windows)+Note: the following will work in a **Linux** terminal, but can also work in a //​terminal//​ on a **Mac** or on a **Windows 10** computer (''​ssh''​ is directly available in ''​Windows Powershell'',​ ''​Windows Terminal''​ or the old ''​cmd'',​ but it is not the most user-friendly ​way to use ''​ssh''​ on Windows) 
 + 
 +If you have a Windows computer, it is much easier to use [[#​a_recommended_ssh_client_for_windows|Putty]] for creating an ''​ssh''​ connection 
 </​WRAP>​ </​WRAP>​
  
-  * ''​ssh [options] [my_login@]remote_server''​ +  ​* **''​ssh [options] [my_login@]remote_server''​** 
-    * If your login is the same on the local and remote computer, you can omit the optional ''​my_login@'':​ e.g. just use ''​ssh ssh1.lsce.ipsl.fr''​+    * If your login is the same on the local and remote computer, you can omit the optional ''​my_login@'' ​part:\\ e.g. just use ''​ssh ssh1.lsce.ipsl.fr''​ 
 +    * The **first time** you connect to a **new server**, ''​ssh''​ will ask if you are sure of what you are doing, and then store some unique information about the remote server in the ''​known_hosts''​ file ([[#​configuration_files|details]]). ''​ssh''​ will check this security information (without asking you) each time you connect to the same server, and warn you if something seems wrong\\ <​code>​PS C:​\Users\my_login>​ ssh ssh1.lsce.ipsl.fr 
 +The authenticity of host '​ssh1.lsce.ipsl.fr (157.136.66.99)'​ can't be established. 
 +ECDSA key fingerprint is SHA256:​vMAvkidEg0EukP/​RZwPAVuo5+TBegQFx1v8WN9pZLXg. 
 +Are you sure you want to continue connecting (yes/no)? yes 
 +Warning: Permanently added '​ssh1.lsce.ipsl.fr,​157.136.66.99'​ (ECDSA) to the list of known hosts. 
 +my_login@ssh1.lsce.ipsl.fr'​s password:</​code>​
  
   * Most common options:   * Most common options:
     * ''​-X'':​ Enable X11 forwarding. This option will allow you to start graphical programs on the remote server     * ''​-X'':​ Enable X11 forwarding. This option will allow you to start graphical programs on the remote server
       * If ''​-X''​ does not work, use ''​-Y''​ instead (Enable //trusted// X11 forwarding)       * If ''​-X''​ does not work, use ''​-Y''​ instead (Enable //trusted// X11 forwarding)
-      * Using the ''​-X''/''​-Y''​ option will automatically define the ''​DISPLAY''​ environment variable that is required by graphical programs on the remote server. Otherwise, ''​DISPLAY''​ will not be defined\\ <​code>​jypeter@lsce5203:​~$ echo $DISPLAY+      * Using the ''​-X''/''​-Y''​ option will automatically define the ''​DISPLAY''​ environment variable that is required by graphical programs on the remote server. Otherwise, ''​DISPLAY''​ will not be defined\\ <​code>​my_login@lsce5203:​~$ echo $DISPLAY
 localhost:​0.0 localhost:​0.0
-jypeter@lsce5203:​~$ ssh ssh1.lsce.ipsl.fr+my_login@lsce5203:​~$ ssh ssh1.lsce.ipsl.fr
 Last login: Wed Jul  8 14:45:31 2020 from 176-142-31-75.abo.bbox.fr Last login: Wed Jul  8 14:45:31 2020 from 176-142-31-75.abo.bbox.fr
-[jypeter@ssh1 ~]$ echo $DISPLAY+[my_login@ssh1 ~]$ echo $DISPLAY
 DISPLAY: Undefined variable. DISPLAY: Undefined variable.
-[jypeter@ssh1 ~]$ logout+[my_login@ssh1 ~]$ logout
 Connection to ssh1.lsce.ipsl.fr closed. Connection to ssh1.lsce.ipsl.fr closed.
-jypeter@lsce5203:​~$ ssh -X ssh1.lsce.ipsl.fr +my_login@lsce5203:​~$ ssh -X ssh1.lsce.ipsl.fr 
-[jypeter@ssh1 ~]$ echo $DISPLAY+[my_login@ssh1 ~]$ echo $DISPLAY
 localhost:​43.0</​code>​ localhost:​43.0</​code>​
       * In order to display graphical windows, you also need to have a local //X server// running!       * In order to display graphical windows, you also need to have a local //X server// running!
Line 60: Line 69:
  
 <​code>​ <​code>​
-alias obelix='ssh -A -X my_LSCE_login@ssh1.lsce.ipsl.fr -t ssh -A -X obelix'​+# Connecting to LSCE from outside the LSCE network 
 +alias sobelix='ssh -A -X my_LSCE_login@ssh1.lsce.ipsl.fr -t ssh -A -X obelix'​
  
 +# Connecting to LSCE from a computer on the LSCE network
 +alias obelix='​ssh -A -X my_LSCE_login@obelix'​
 +
 +# Connecting to ciclad @ IPSL
 alias ciclad='​ssh -A -X my_ciclad_login@ciclad.ipsl.jussieu.fr'​ alias ciclad='​ssh -A -X my_ciclad_login@ciclad.ipsl.jussieu.fr'​
 </​code>​ </​code>​
Line 67: Line 81:
 ==== Configuration files ==== ==== Configuration files ====
  
-''​ssh''​ will store all its configuration files in the ''​~/​.ssh/''​ directory (''​C:​\Users\your_windows_login\.ssh''​ on Windows 10)+''​ssh''​ will store all its configuration ​text files in the ''​~/​.ssh/''​ directory (''​C:​\Users\your_windows_login\.ssh''​ on Windows 10)
  
-  * ''​known_hosts'':​ the first time you connect to a new server, ​''​ssh'' ​will ask if you are sure of what you are doing, and then store some unique ​information about the remote server in the ''​known_hosts''​ file. It will check this information (without asking you) the next time you connect ​to the same server, and warn you if something seems wrong\\ <​code>​PS C:​\Users\jypeter>​ ssh ssh1.lsce.ipsl.fr +  * ''​known_hosts'':​ the file were ''​ssh'' ​stores security ​information about all the servers ​you have connected ​to (from the local computer)
-The authenticity of host '​ssh1.lsce.ipsl.fr (157.136.66.99)' can't be established. +
-ECDSA key fingerprint is SHA256:​vMAvkidEg0EukP/​RZwPAVuo5+TBegQFx1v8WN9pZLXg. +
-Are you sure you want to continue connecting (yes/no)? yes +
-Warning: Permanently added '​ssh1.lsce.ipsl.fr,​157.136.66.99'​ (ECDSA) to the list of known hosts. +
-jypeter@ssh1.lsce.ipsl.fr'​s password:</​code>​+
  
   * ''​config'':​ an optional configuration file   * ''​config'':​ an optional configuration file
Line 81: Line 90:
  
 ==== A recommended ssh client for Windows ==== ==== A recommended ssh client for Windows ====
 +
 +[[other:​win10apps#​putty_pageant|Putty]] is a convenient and user-friendly //ssh client// for Windows
  
 ===== Just transferring files ===== ===== Just transferring files =====
  
 +Sometimes you just need to copy files from one server to the other. The files can be securely copied //over ssh// with the ''​scp''​ command
 +
 +Note: if you work with big data files, you should keep the files were they are instead of duplicating them, and move the data processing (your scripts, etc...) to the server where the files are located (e.g. the ciclad server)
  
 ===== Using ssh keys ===== ===== Using ssh keys =====
other/ssh.txt · Last modified: 2023/05/03 08:32 by jypeter