Wednesday, January 10, 2018

To generate Public/Private SSH Key



ssh-keygen  using this command we can generate two keys, one public (the one you will share to the server) and the other one is private
and you shall not share with anyone.

Once the public key is copied in the ~/.ssh/authorized_keys in the server, you can login without being prompt for password.


1) As per below screen can see a prompt asking you for the location to save the key. The default location is the .ssh folder in your Home directory. You can just press “Enter” to accept the default setting.


2)Below screen is to passphrase to unlock the private key so that no one can access your remote server even if they got hold of your private key. The passphrase is optional. To leave it blank, just press “Enter”.


3)Public and private SSH key should now be generated. Open the file manager and navigate to the .ssh directory. You should see two files: id_rsa and id_rsa.pub.

4)Upload the id_rsa.pub file to the home folder of your remote host. Connect to your remote host via SSH and use the following command to move the public key to the correct location.

cat id_rsa.pub >> ~/.ssh/authorized_keys
rm id_rsa.pub

5) Remote host, open the SSH config file:

 /etc/ssh/sshd_config

6) Scroll down the config file and make sure the following attributes are set correctly.

RSAAuthentication yes
PubkeyAuthentication yes
PasswordAuthentication no

7) Finally, restart the SSH server in the remote host

sudo /etc/init.d/ssh reload

8)Now we can connect to remote host with the following command:

ssh -i /path-to-private-key username@remote-host-ip-address

# private key
openssl genrsa -out privkey.pem 2048

# public key
openssl rsa -in privkey.pem -pubout -out pubkey.pem


#To remove the pass phrase on an RSA private key:
 openssl rsa -in key.pem -out keyout.pem

#To encrypt a private key using triple DES:
 openssl rsa -in key.pem -des3 -out keyout.pem

#To convert a private key from PEM to DER format:
 openssl rsa -in key.pem -outform DER -out keyout.der

#To print out the components of a private key to standard output:
 openssl rsa -in key.pem -text -noout

#To just output the public part of a private key:
 openssl rsa -in key.pem -pubout -out pubkey.pem

#Output the public part of a private key in RSAPublicKey format:
 openssl rsa -in key.pem -RSAPublicKey_out -out pubkey.pem

7 comments:

  1. Hi. The article is awesome, By your article i have clearly understood how to generate public key for SSH Key for Sap Basis,the steps are so clearly thank you.

    ReplyDelete
    Replies
    1. Sap Basis Crew: To Generate Public/Private Ssh Key >>>>> Download Now

      >>>>> Download Full

      Sap Basis Crew: To Generate Public/Private Ssh Key >>>>> Download LINK

      >>>>> Download Now

      Sap Basis Crew: To Generate Public/Private Ssh Key >>>>> Download Full

      >>>>> Download LINK ap

      Delete
  2. Sap Basis Crew: To Generate Public/Private Ssh Key >>>>> Download Now

    >>>>> Download Full

    Sap Basis Crew: To Generate Public/Private Ssh Key >>>>> Download LINK

    >>>>> Download Now

    Sap Basis Crew: To Generate Public/Private Ssh Key >>>>> Download Full

    >>>>> Download LINK MJ

    ReplyDelete