How to Generate SSH Key

What is the SSH ? The SSH is the protocol that provide the remote control to users.

How to Generate SSH Key

What is the SSH ?

The SSH is the protocol that provide the remote control to users. Default protocol port of the SSH is 22. You can connect to Linux and MacOS operating system and manage them. You can see an example SSH protocol screen below.

Linux Command Screen

How can I generate the SSH Key?

If you are using the Windows OS, you can do that by PuTTY program. As you know, the PuTTY program is the developed program for connecting to SSH. When you install this program, the program called PuTTYgen is installed automatically. You can see the interface of this program below.


Please select the RSA at “Type of key to generate” field. You can leave the value that placed at the bottom as 2048. Actually that value is asking that how many bits key file would you want to create. After that, you can click the “Generate” button to generate your 2048 bit key file. After clicking the “Generate” button, the following screen will appear.


Please wait for the loading bar to complete. When completed, a screen like the following screen will appear.


The SSH RSA key has been generated. Now, we are going to save the key file. Please click the “Save public key” button and save your public key. Do you want to protect the key file with a password, you can type the “Key passphrase” field to do it. Thus you can protect the SSH key file with a password! So that, this will allow you to use your Public Key for authorization where you defined it.

Adding the Public Key to Remote Server

SSH Key Generator

With the file you just created, If you want to connect to your server over SSH protocol then you should do following actions. We should copy to clipboard the “Public key for pasting into OpenSSH authorized_keys file” field.

After that, please log in to the server which do you want to add the SSH key and type the following command.

nano ~/.ssh/authorized_keys

Paste the text which copied to opened screen (you can this action by one-time click to right button of your mause). To save it please use the CTRL + X combination and you should exit the file. Now, to active the key file which just pasted we should restart the SSH service. For that, probably it will be enough type the following command. Please select a command that is compatible with your server. If you cannot see your operating system which you connected in the list below, please research for it on the internet.

For CentOS / RHEL / Fedora / Redhat

/etc/init.d/sshd restart


service sshd restart


sudo systemctl restart sshd

For Debian / Ubuntu

/etc/init.d/ssh restart


service ssh restart


sudo service ssh restart

You have been defined your public key to server. So that, you can connect to SSH protocol with your key file without typing the password. You need to type your username to log in only.

Leave a Reply