Scope
This article covers the basics of creating an SSH key, what an SSH key is, and best practices of SSH security. Detailed instructions are provided for creating both public and private SSH keys. Instructions for Windows and Linux based operating systems are provided below.
What are SSH keys and how can I use them?
Note: SSH keys are supported only for Linux based machines.
SSH keys are a common way to connect securely to remote machines. They are based on the SSH cryptographic network protocol, which is responsible for the encryption of the information stream between you and the remote machine. Ultimately, using SSH keys, you can connect to your server more securely without entering a password.
No password? How is this possible?
- SSH is based on "public-key cryptography". Simply put, there is a private key, safely stored in the home machine of the user, and a public key, stored in any remote machine the user wants to connect.
- Whenever a user initiates an SSH connection with a remote computer, SSH first checks if the user has a private key that matches any of the public keys in the remote machine. If it does, you will be logged in; if it does not, it will prompt you for the password.
How do I create an SSH public key for Windows?
There are several ways to generate a public key in Windows. Whichever method you choose, be sure to upload your public key to the website or server you will be using.
PuTTY
This is a Free Open-Source Software (FOSS) solution for Windows that allows users to generate SSH keys and use them to access Linux servers via an SSH connection.
Download and run the PuTTY "Installer" from this page: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
Generate a private and public key pair:
- Go to the Windows Start menu -> All Programs -> PuTTY and open PuTTYgen
- Click the 'Generate' button and PuTTYgen will ask you to make some random movement with your mouse until it has enough data to generate a secure key for you.
- Click the 'Save private key' button and save the resulting file somewhere safe and only accessible by you!
- Export Public key to the server.
Git Bash
Generating a new SSH key
- Download Git Bash from https://git-for-windows.github.io/
- Open Git Bash.
- Paste the text below, with your email address.
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"- This creates a new SSH key, using the provided email as a label.
Generating public/private RSA key pair.
- When you're prompted to "Enter a file in which to save the key," press Enter. This accepts the default file location.
- Enter a file in which to save the key (/c/Users/you/.ssh/id_rsa):[Press enter]
- At the prompt, type a secure passphrase.
- Enter passphrase (empty for no passphrase): [Type a passphrase]
- Enter same passphrase again: [Type passphrase again]
Server Management Done Right
Creating an SSH key is a vital part of collaborative work and server management. There are numerous applications that make use of RSA-SSH keys, including popular code hub, Github.com.
It is a secure way to connect to your device and can be easily shared with others without risk. Once you are finished setting up your SSH key, you can dive right in to your projects and and share with others securely without the use of passwords!
Comments
0 comments
Please sign in to leave a comment.