Video Walkthroughs at Superb Internet
close
Domain Name / Customer ID:

Password:

Forgot Password

All material © 1996 - 2024 Superb Internet Technologies Inc. // version-1.50.33
« Back to all videos

Creating and using SSH keys

Creating and using SSH keys

As the third video in this series on making SSH access to a CentOS Linux server more secure, this tutorial will show you:

How to Create and Use SSH Keys with PuTTY

With this video tutorial, you will learn how to use SSH keys to connect to a CentOS server from a Windows PC, using the PuTTY SSH client and PuTTYgen utilities. You can download PuTTY and the PuTTYgen utilities from the URL displayed in this video and from the link in the text below.

  1. To generate a set of RSA keys, launch the PuTTYgen utility. RSA is a cryptosystem for public-key encryption.
  2. On the PuTTYgen Key Generator screen, make sure the "SSH-2 RSA" option is selected, then click the “Generate” button, and move your mouse around the area, as instructed on the screen. This will generate some randomness and will take a few seconds to complete, as seen in the progress bar.
  3. Once complete, you will see a generated public/private key pair. In the "Key comment:" field you can enter any comment you like to help you identify the generated key pair. Click the "Save public key," choose location to save it, name the file as you like and click "Save."
  4. On the PuTTY Key Generator screen, click the "Save private key"
  5. On the "PuTTYgen Warning" window, click "Yes."
  6. Choose the location to save the file, name the file as you like, and click "Save."
  7. The location of the files can be the same, but ensure that only you have access to it and that you do not lose the keys. Next, right click in the text field beneath, "Public key for pasting into OpenSSH authorized_keys file:" and choose "Select All."
  8. Right click again and choose "Copy."
  9. Now, you will save your copied public key log to the CentOS server. Open the terminal and at the command prompt type
    mkdir ~/.ssh
    and press Enter.
  10. Then, type
    chmod 0700 ~/.ssh
    and Enter.
  11. Next, type
    touch ~/.ssh/authorized_keys
    and Enter.
  12. Then, type
    chmod 0644 ~./ssh/authorized_keys
    and Enter.
  13. Now you will edit the authorized keys system file. At the prompt, type
    sudo vi ~./ssh/authorized_keys
    and press Enter to execute the editor. If prompted to enter sudo password type your user's password and press Enter.
  14. On the editor screen, press the Insert. key and right click your mouse to paste the copied public key.
  15. Press the Esc. key, type :w and press Enter to save the file.
  16. Type :q and press Enter to exit the editor.
  17. To configure the PuTTY profile in your Windows PC, open the PuTTY utility. In the "Host Name (or IP address)" field enter your server's IP
  18. In the "Port" field, enter the custom port configured during the “How to Change the Default SSH Port” tutorial.
  19. Make sure the "Connection type:" is SSH. In the "Category:" section on the left pane under “Connection,” choose "Data." In the "Auto-login username" field, enter the user name you created in the How to Create a New User tutorial. Go to the "Category:" section in the left pane and under “Connection,” expand "SSH." Under "SSH," highlight "Auth" to access the Options controlling SSH authentication screen.
  20. In the "Authentication parameters" section click the "Browse..." button and browse to the location where your private key file is stored. Choose it and click "Open."
  21. In the "Category:" section in the left pane, highlight "Session," and enter a chosen name for the profile in the "Saved Sessions" field and click “Save.”
  22. Choose the newly saved profile, and click "Open" to connect to your CentOS server using the SSH key pair.

Thanks for joining us and return often to see new tutorials from Superb.net.


comments powered by Disqus