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.exe
binary. -
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_keys
file on the Linux machine as follows:- Start an SSH session to one of your cluster nodes.
- Open the
~/.ssh/authorized_keys
file in your favorite editor, for example,vim
oremacs
.- 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
Path
variable in the "User variables" panel. -
Select the
Path
variable 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
OK
button to confirm the modified value. -
Click the
New
button under the "System variables" panel. The "New System Variable" dialog box should appear. -
Create a new environment variable named
KEYPATH
with a value equal to the full path to the private key file.- Example:
C:\Users\username\Documents\id_rsa.ppk
- Example:
-
Click the
OK
button 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:
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.ppk
private key that you created previously. - Click
Open
in the dialog box. - Click the
Open
button 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
Save
button to save the configuration.
Error "the server's host key not cached"#
-
Download
plink.exe
from 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.exe
binary, if you have downloaded it directly. -
Execute
plink.exe FRONTEND
for the host where you would like to connect.- Example:
plink.exe jed.hpc.epfl.ch
- Example:
-
Answer
y
to the questionStore key in cache? (y/n)
. -
Press
Ctrl+C
to 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.