- Login to your account on the remote server.
- Create a file ~/.ssh/authorized_keys file and placed in the putty public key with the following format:
ssh-rsa <PUBLIC_KEY> <KEY_COMMENT>
Note: If you don’t have a public key generated you can follow the procedure from Generating Putty SSH Key Pair.
If the file already exists then append the public key on a new line with the same format specified earlier.
- If necessary update the permission of the authorized_keys file with the following command:
chmod 600 ~/.ssh/authorized_keys
- If necessary update the permission of the .ssh directory with the following command:
chmod 700 ~/.ssh
- Setup the Pageant (see Using Pageant to hold the Putty Private Key) to hold the private key (and passphrase).
- Run the Putty application.
- Fill-up Host Name (or IP Address) field with the following format:
Where fields are defined as follows:
<USERNAME> is the account name used on step 1.
<HOST_NAME_OR_IP_ADDRESS> is the remote server used on step 1.
- Click the Open button and expect to be connected to the remote server without it asking you to provide your password (or even your passphrase).
- Run the Pageant daemon that will listen to a putty SSH connection.
- Right click the Pageant icon from the taskbar that can be identified like the following:
- Select Add Key.
- Browse and select the target private key (i.e. ppk file).
Note: If you don’t have a private key generated you can follow the procedure from Generating Putty SSH Key Pair.
- Supply the passphrase of the key if required.
Passing the Private Key upon running the Pageant Daemon
Every time at a pageant daemon was started the private key must be added. To simplify this, we can add the private key as a parameter on the target field of the shortcut of the pageant daemon like the following:
Where the fields are defined as:
<PAGEANT_EXECUTABLE> is "C:\putty\bin\pageant.exe"<PRIVATE_KEY> is "C:\private-key.ppk"
Note: If the key has a passphrase it must be provided every time.
- Run the Puttygen (i.e. Putty Key Generator).
- Click the Generate button.
- Move the mouse cursor on the blank area provided by the generator.
- Update the Key comment field if desired.
- Provide an identical passphrase to the following fields if desired:
- Click Save private key button.
- Click Save public key if desired.
The content of public key file is the one to be copied on the server with the following format:
ssh-rsa <CONTINUOUS_PUBLIC_KEY> <KEY_COMMENT>
And the file normally have the following format:
---- BEGIN SSH2 PUBLIC KEY ----
---- END SSH2 PUBLIC KEY ----
You are reading it right, in the file, the public key (i.e. DELIMITED_PUBLIC_KEY) is delimited by a carriage return. Thus, you need to remove it to have the CONTINUOUS_PUBLIC_KEY.