How to configure PuTTY SSH to transfer files to clusters from Windows#
Table of contents#
Download PuTTY#
Download from the author's website the *-installer.msi and execute
it to install the necessary binaries.
Alternatively, you may directly download the following binaries:
putty.exe: the core executable to initiate SSH connections.puttygen.exe: required to create cryptographic keys.
If the above link is invalid, please perform a web search for "PuTTY".
Create a cryptographic key#
Create a cryptographic key using PuTTYGen as follows:
-
Execute the
puttygen.exebinary. -
Click "Generate" on the PuTTY Key Generator dialog box.
-
Change the Key comment to include your machine name and Windows username.
-
Do not enter a key passphrase.
-
Save the private key file without a passphrase.
- Example:
C:\Users\username\Documents\id_rsa.ppk.
- Example:
-
Move the public portion of the key to the Linux machine (for example,
jed.hpc.epfl.ch). This requires you to edit the~/.ssh/authorized_keysfile on the Linux machine as follows:- Start an SSH session to one of your cluster nodes.
- Open the
~/.ssh/authorized_keysfile in your favorite editor, for example,vimoremacs.- Create the file, instead, if it does not already exist.
- Copy all text from the "Public key for pasting" box in PuTTYGen.
- Paste the copied text into
~/.ssh/authorized_keys. The entire text must be pasted in a single line; do not add any line breaks.
Modify system environment variables#
-
Open the Windows "System Properties" dialog box.
-
Navigate to the Control Panel, select "System", then "Advanced system settings."
-
Select the "Advanced" tab.
-
Select "Environment Variables." The Environment Variables dialog box should appear.
-
Locate the
Pathvariable in the "User variables" panel. -
Select the
Pathvariable and then click theEdit button. The "Edit System Variable" dialog box should appear. -
Add the PuTTY install directory to the variable value field. Separate it from existing values with a semicolon (
;).- Example:
C:\some\existing\path;C:\Program Files\putty
- Example:
-
Click the
OKbutton to confirm the modified value. -
Click the
Newbutton under the "System variables" panel. The "New System Variable" dialog box should appear. -
Create a new environment variable named
KEYPATHwith a value equal to the full path to the private key file.- Example:
C:\Users\username\Documents\id_rsa.ppk
- Example:
-
Click the
OKbutton to confirm the new variable. -
Reboot the computer for environment changes to take effect.
The image below illustrates an example configuration of the environment variables:
Change Defulat Settings in Putty SSH#
- Launch
putty.exe. - Go to Session, select
Default Settings, and clickLoad. - Go to Connection, enable
Enable TCP keepalives, and setSeconds between keepalivesto 60. - Go back to Session, and select
Default Settingsso it is marked in blue (note: don't clickLoad). - Click
Save. - Close
putty.exe.
Test SSH key authentication#
- Launch
putty.exe. - Enter the remote server host name or IP address under "Session."
- Navigate to
Connection > SSH > Auth. - Click
Browse...underPrivate key file for authentication. - Locate the
id_rsa.ppkprivate key that you created previously. - Click
Openin the dialog box. - Click the
Openbutton in the main program to log into the remote server with key pair authentication.
Troubleshooting#
Error "ssh_init: Network error: Cannot assign requested address"#
- Launch
putty.exe. - Select the "Default Settings" on the on the PuTTY configuration box.
- Verify that the "Port" is set to
22. - Click the
Savebutton to save the configuration.
Error "the server's host key not cached"#
-
Download
plink.exefrom the author's website.- Skip this step if you have already installed the application via the installer.
-
Open the Windows command line.
-
Navigate to the folder that contains the
plink.exebinary, if you have downloaded it directly. -
Execute
plink.exe FRONTENDfor the host where you would like to connect.- Example:
plink.exe jed.hpc.epfl.ch
- Example:
-
Answer
yto the questionStore key in cache? (y/n). -
Press
Ctrl+Cto abort the rest of the process.
Example output:
> plink.exe jed.hpc.epfl.ch
The server's host key is not cached in the registry. You
have no guarantee that the server is the computer you
think it is.
The server's rsa2 key fingerprint is:
ssh-rsa 2048 2e:db:b6:22:f7:bd:48:f6:da:72:bf:59:d7:75:d7:4e
If you trust this host, enter "y" to add the key to
PuTTY's cache and carry on connecting.
If you want to carry on connecting just once, without
adding the key to the cache, enter "n".
If you do not trust this host, press Return to abandon the
connection.
Store key in cache? (y/n)
Answer y to the question in the above example.
