To set up an SSH key using PuTTY on Windows, open PuTTYgen, generate a key pair by clicking "Generate," provide a passphrase, save the private key (usually with a .ppk extension), copy the public key, and then paste it into the authorized_keys file on the remote server you want to access, configuring PuTTY to use the saved private key for authentication when connecting.
Key steps:
- Open PuTTYgen: Download and run PuTTYgen from the PuTTY package.
- Generate key pair: Click "Generate" and move your mouse randomly in the progress bar to create a strong key.
- Set passphrase: Enter a passphrase to protect your private key and confirm it.
- Save private key: Click "Save private key" and choose a filename with a .ppk extension.
- Copy public key: Select the generated public key in the "Public key for pasting into OpenSSH authorized_keys file" area and copy it.
- Paste public key on remote server: Access your remote server and paste the copied public key into the authorized_keys file located in your user directory (usually
~/.ssh/authorized_keys
). - Configure PuTTY session:
- Open PuTTY and enter the server's hostname or IP address.
- Navigate to "Connection" > "SSH" > "Auth".
- Click "Browse" and select the saved private key (.ppk file).
- Open PuTTY and enter the server's hostname or IP address.
Important points to remember:
- Key file extension: PuTTY uses the .ppk extension for private keys.
- Protecting your private key: Keep your private key secure and never share it publicly.
- Adding multiple keys: You can add multiple SSH keys to PuTTY by repeating the process and selecting the appropriate key for each server connection.