Generate Rsa Key Using Puttygen
PuTTYgen is a tool used for generating public and private SSH keys which are its fundamental function. Though it collects keys in its own file format i.e. .ppk files, keys can also be transformed to any other file format quickly. It is available for the various operating system, i.e. Windows, Linux, Mac, etc. PuTTYgen.exe is the graphical tool on Windows OS. While on the other side, Linux OS has the only command-line version.
Contents
Use RSA and DSA key files with PuTTY and puttygen. This post covers how to log into an SSH server with PuTTY using an RSA or DSA private keyfile. Some SSH servers require the use of these RSA and DSA key files for greater security when logging in, because additional authenication is required in the form of the keys. On you computer, click Start, All Programs, PuTTY, and then PuTTYgen. Select SSH-2 RSA in the Parameters area. Enter 1024 in the Number of bits in a generated key field. Click Generate and then move the cursor around the blank area of the Key area to generate the random characters that create a unique key. Generate SSH Keys on Windows with PuTTYGen (the PuTTY Key Generator) June 9, 2017 Windows. To generate SSH public and private key pairs on Windows, one of the easiest tools to use, is the PuTTY Key Generator “puttygen.exe” (which can be downloaded from here). On you computer, click Start, All Programs, PuTTY, and then PuTTYgen. Select SSH-2 RSA in the Parameters area. Enter 1024 in the Number of bits in a generated key field. Click Generate and then move the cursor around the blank area of the Key area to generate the random characters that create a unique key. Mar 27, 2019 Set up SSH public key authentication. Generate Key Pair. If you do not have a key pair yet, start with generating new key pair. Configure Server to Accept Public Key. Save a public key file from PuTTYgen, and copy that into the.ssh2 subdirectory of your account home directory.
- 2 Download PuTTYgen
- 2.1 Download PuTTYgen on Windows
- 2.2 Download PuTTYgen for Mac
- 2.3 Download PuTTYgen for Linux
PuTTYgen is used to generate public or private key pair for creating SSH keys. Below is the complete guidance about how to generate RSA key in Windows operating system:
- Once you install the PuTTY on your machine, you can easily run PuTTYgen. For the same, go to Windows -> Start Menu -> All Programs -> PuTTY -> PuTTYgen.
- You will see the PuTTY key generator dialog box on your screen
- You will find a “Generate” button in that dialog. Clicking on it will lead to generating the keys for you.
- Now you will need to add a unique key passphrase in the Key passphrase and Confirm passphrase field.
- Click on the “Save Public Key” and “Save Private Key” buttons to save your public and private keys.
- You will see the text starting with ssh-RSA in the Public key for pasting into OpenSSH authorized_keys file field which is located at the top of the window. Copy that entire text to your clipboard by pressing ctrl+c as you will require the key to paste on your clipboard in the public key tool of control panel or directly on the cloud server.
Various Ways to Use RSA Key Pair
Generate Rsa Key Using Puttygen Data
RSA key pair generated through PuTTYgen is used in two various ways defined as below:
- To assign while creating a new cloud server
You can choose the public key from the given list of keys at the time of creating cloud server. If you don’t find your key in that list, then first add and then assign it. - Assign to an existing cloud server
At the time of connecting to the cloud server, first of all, you need to tell PuTTY to use it for utilizing your newly created RSA key pair.
The installation of PuTTYgen is very simple as it is installed as a part of normal PuTTY .msi package installation. You can follow the simple steps to download PuTTYgen software for your system. That is the reason why you don’t need to download PuTTYgen separately. Once you download PuTTY software, you will be able to install and run PuTTYgen easily in no time. Below is the complete instruction about how to download and install PuTTY on Windows.
Download PuTTYgen on Windows
The very first requisite is to acquire the copy of PuTTY installation package. If your system is of 64-bit, then you should install a 64-bit version of PuTTY, i.e. putty-64bit-<version>-installer.msi. In case of a 32-bit operating system, you will need to install the 32-bit version of PuTTY, i.e. putty-<version>-installer.msi
Go to PuTTY Installation Download page, where you will find the download link of PuTTY installation package with the exhaustive details of its installation, setup instruction, verifying release signature, various alternatives, many more.
Once the PuTTY installation package is downloaded successfully, now it’s time to install it by starting the installer. Go to How to install PuTTY on Windows where you will find the step by step guidance for PuTTY installation for Windows operation system.
After successfully downloading and installing PuTTY on your Windows machine, you are just 2-3 clicks away to run PuTTYgen. Follow the below-given step by step guidance to run PuTTYgen:
Run PuTTYgen on Windows
1. Go to Windows -> Start Menu -> All Programs -> PuTTY -> PuTTYgen. You will see a window for PuTTY Key Generator on your screen.
That’s it. Now you can generate public or private key pair using PuTTYgen.
Download PuTTYgen for Mac
You can find the step by step guide to download PuTTYgen for Mac operating system. Command-line SSH client is a part of the Mac operating system. To utilize it, go to Finder and then opt for Go -> utilities from the top menu. After that find the terminal which supports SSH connections to remote servers.
Ported PuTTY for Mac
Mac has the port of PuTTY which can be installed in various ways described as below:
- Installation using Homebrew:
Use the below-given command to install PuTTY in case you have already installed “brew”command.sudo brew install putty - Installation using MacPorts:
PuTTY is easily available through MacPorts. First of all, install MacPorts and then apply the below-given command.
sudo port install puttyUse the below-given command to add the shortcut on the desktop.cp /opt/local/bin/putty ~/Desktop/PuTTY - Alternatives to PuTTY on Mac OSCyberduck, used by many people on Mac OS is the best SSH Client is the ultimate alternative to PuTTY on Mac OS.
Download PuTTYgen for Linux
Openssl aes 256 key generation. In order to download PuTTYgen for Linux (Ubuntu) operating system, one required to install PuTTYgen separate from the PuTTY client in case of some Linux distributions.
For example, Debian Linux requires the below-given code to install PuTTYgen:
sudo aptitude install putty-tools
Generate Key Pair for Authentication in Linux
Use the below command to create the key pair for authentication in Linux.
Generate Rsa Key Openssl
PuTTYgen -t RSA -b 2048 -C “user@host” -o keyfile.ppk
Various Command Line Options of PuTTY in Linux
Below is the list of important command line options for PuTTY in Linux operating system.
PuTTYgen [-t keytype [-b bits] [-q] keyfile]
[-C new-comment] [-P]
[-O output-type -p -l -L]
[-o output-file]
Options:
- Keyfile – It is the name of the existing key file to read at the time of changing the current key.
- -t keytype – This command specifies the type of the key to creating. Its acceptable values are RSA and dsa.rsa1.
- -b bits – This command specifies a total number of bit in a particular key. 1024 is the perfect size for DSA key, while 2048 or 4096 are the perfect size for RSA keys.
- -q – This command suppresses the message about progress at the time of key generation.
- -C new-comment – This command is used to specify the comment to describe the key. It can be used for new and/or existing key. Key operation is not affected by comment. However, it is used to recognize the key owner, it’s not reliable completely as any value can be applied to it.
- –P – This command is used to update the passphrase of a key. Passphrase helps to encrypt the private key. As passphrase can’t be add or update on command line, it prompts a new passphrase tool to alter it.
- –old-passphrase-file – The old password of the key remains in this file. This is used when the key is protected by a passphrase.
- –new-passphrase file – This file entails the new passphrase of the key. This command comes in the action either at the time of generating new key or while applying –P command to change the passphrase.
- -O output-type – This command defines what to give in output. By default, the private key is the output.
Thus, above are the prominent commands of PuTTYgen in Linux operating system. There are many other commands also available to perform a various task from the command prompt in Linux at flank speed.
To generate SSH public and private key pairs on Windows, one of the easiest tools to use, is the PuTTY Key Generator “puttygen.exe” (which can be downloaded from here).
The resulting generated files from the PuTTY Key Generator can be used to set up public key authentication with a remote server, allowing for more secure authentication over normal password based authentication (requires disabling password based authentication).
Download the PuTTY Key Generator
You can download puttygen from the following url:
https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html
Run puttygen.exe
When puttygen has loaded you will be presented with a screen such as this:
Generate the public and private keys
Click the “Generate” button on the main window to start the process of generating the key data.
While this is happening, you will need to move your mouse around in the blank area at the top of the application. This is used to help randomize the data used to generate the keys.
Once the progress bar has gone through, the public and private key data will have been generated, and you are ready to save the keys.
Saving the public and private keys
Public Key:
Simply press the “Save public key” button. This will be used on the remote host you want to be able to connect into remotely, using the private key.
Private Key:
You have the option to enter a passphrase if you want to make the key more secure. Enter that in, and the confirmed passphrase.
After thats done (or if you dont want to use a passphrase), simply press the “Save private key” button. Store this key in a safe place.
Using the private key in PuTTY
For information on how to use the private key file in PuTTY, please check the following page:
Using SSH Private Key Files with PuTTY