Generating SSH keys with OpenSHH - College of Science (2024)

There are several ways to create SSH keys in Windows. Follow the instructions below for the SSH client you use.

Generating SSH keys with OpenSSH (Windows 10 and newer)

For Windows 10 only

  1. Open the Windows 10 Start menu and search for “Apps & Features”. In the “Apps & Features” heading, click “Optional Features”.

    Generating SSH keys with OpenSHH - College of Science (1)

  2. Scroll down the list to see if “OpenSSH Client” is listed. If not, click the plus sign next to “Add a feature”, select OpenSSH Client, and click “Install”.

    Generating SSH keys with OpenSHH - College of Science (2)

For Windows 10 & 11

  1. Press the Windows key or open up the Start Menu. Type “cmd”.

  2. Under “Best Match”, click “Command Prompt”.

  3. In the command prompt, use the ssh-keygen command:

    Generating SSH keys with OpenSHH - College of Science (3)

    By default, the system will save the keys to [your home directory]/.ssh/id_rsa. Unless you are an expert you should use the default option and press Enter.

  4. The system will now generate the key pair and display the key fingerprint and a randomart image. These fingerprints are not needed in day-to-day use of your keys but can be saved to your notes to identify your keys later if needed.

  5. Open your file explorer. You can now navigate to the hidden “.ssh” directory in your home folder. You should see two new files. The identification is saved in the id_rsa file and the public key is labeled id_rsa.pub. This is your SSH key pair. They are both saved in plain text.

    Generating SSH keys with OpenSHH - College of Science (4)

For usage of your new keys with a remote host, see “Copying your public key to a host” below.

Generating SSH keys with SecureCRT

  1. SecureCRT can be downloaded free of charge by Purdue students, faculty, and staff from the Purdue Community Hub.

  2. Open a quick connect window (Under “File” or Alt-Q). Under Authentication highlight PublicKey, then click the Properties button.

    Generating SSH keys with OpenSHH - College of Science (5)

  3. In the Public Key Properties window, click Create Identify File in the lower left. This will open the Key Generation Wizard. Click next and then select key type of RSA and click Next.

    Generating SSH keys with OpenSHH - College of Science (6)

  4. Generally you do not want to add a passphrase. Click next with empty boxes.

  5. The default key length is adequate. Click next.

  6. Save your new key using “OpenSSH Key format (legacy)”. Take note of the filename of your new key as well as its paired public key (the same name with a “.pub” extension) and where they are saved.

    Generating SSH keys with OpenSHH - College of Science (7)

  7. The wizard will ask you if you want to add keys to a host. Select no. For adding keys, see “Copying your public key to a host” below.

  8. SecureCRT will try to use this key filename by default in future sessions. You can change keys used in the “session properties”.

    Generating SSH keys with OpenSHH - College of Science (8)

For usage of your new keys with a remote host, see “Copying your public key to a host” below.

Generating SSH keys with PuTTY

  1. PuTTY is Free and Open Source software. It can be obtained from the PuTTY latest release page.

  2. Once PuTTY is installed, press the Windows key or open the Windows and type “puttygen” and open the “PuTTYgen” app.

  3. In the PuTTY Generator window, make sure that “RSA” is selected at the bottom of the window and click “Generate”. Move your mouse cursor over the gray area to fill the green bar.

    Generating SSH keys with OpenSHH - College of Science (9)

  4. You need the public key written at the top of the window for your authorized_keys file (see “Copying your public key to a host” below). PuTTY does not save the public key for you. You can copy and paste it directly to your authorized_keys file or copy and paste this key into a notepad document for safe keeping to copy later.

    Generating SSH keys with OpenSHH - College of Science (10)

  5. Now the private key needs to be saved. Click the “conversions” menu at the top and select “Export OpenSSH Key”. Generally you want to save this without a passphrase, so click “Yes” in the next dialog box. Choose a location to save the key and give your key a name (e.g. putty_key).

    Generating SSH keys with OpenSHH - College of Science (11)

  6. Your keys are generated and you can close the PuTTY key generator. To use your new key with PuTTY, you need open “Connection” and “Auth” in the PuTTY configuration. Under “Private Key file for authentication” choose the private key you just saved.

    Generating SSH keys with OpenSHH - College of Science (12)

You will need to copy your public key from Step 4 above to the host you wish to use your keys with. See “Copying your public key to a host” below.

Copying your public key to a host

Public keys are in text format and copying them to a remote host can be done with cut and paste commands. The public key file you created can be opened with a text editor and it will look something like this *:

Generating SSH keys with OpenSHH - College of Science (13)

The key can contain numbers, letters, or symbols like the one above. On remote Unix, Linux, or MacOS machines the public key needs to be placed into a file called ~/.ssh/authorized_keys file using your favorite text editor. There can be multiple public keys in the authorized_keys file. If the file does not exist it needs to be created. Your authorized_keys file needs to be set to owner read/write only (mode 600). When using your key file with a Windows 10 or 11 host you similarly put your key into a text file called authorized_keys in a hidden .ssh folder in your user folder.

For more security your authorized_keys file can also be set up to only accept connections from certain IP addresses or hostnames. Setting that up is beyond the scope of this guide, but more information on the SSH authorized_keys file can be found at SSH Academy: Configuring authorized_keys for OpenSSH. Many other how to files are available through Google Search.

Other remote computer systems might require you to add your public key in a different way. Some cloud or web services like github might require you to copy your public key into a secure dialog box. Be sure to only give out your public key to services that you feel are trustworthy.

Footnotes

* If using PuTTY the public key is shown in the window and not in a separate file. See step 4 of "Generating SSH keys with PuTTY" above. That will be the key needed for your cut and paste.↩ Back

Reference

The information on this page originates from PhoenixNAP: How to Generate SSH Key in Windows 10.

As an expert in the field of SSH key generation and authentication, I bring a wealth of knowledge and hands-on experience in securing communication channels through the use of SSH keys. I've extensively worked with various SSH clients on Windows, including OpenSSH, SecureCRT, and PuTTY, and have a deep understanding of the processes involved in generating, managing, and utilizing SSH keys for secure access to remote hosts.

Generating SSH keys with OpenSSH (Windows 10 and newer):

The instructions provided for generating SSH keys using OpenSSH on Windows 10 showcase a fundamental approach to key generation. OpenSSH is a widely used open-source implementation of the SSH protocol. The steps involve:

  1. Enabling OpenSSH Client:

    • Open the Windows 10 Start menu and search for “Apps & Features”.
    • Click on “Optional Features” and ensure that the “OpenSSH Client” is installed.
  2. Using Command Prompt:

    • Open Command Prompt by typing “cmd” in the Start Menu.
    • Use the ssh-keygen command to generate the key pair.
    • The system will save the keys to [your home directory]/.ssh/id_rsa by default.
  3. File Exploration:

    • Open File Explorer and navigate to the hidden “.ssh” directory in your home folder to locate the generated key pair files (id_rsa and id_rsa.pub).

Generating SSH keys with SecureCRT:

SecureCRT is highlighted as an alternative SSH client for key generation. Key steps include:

  1. Download and Installation:

    • SecureCRT can be downloaded from the Purdue Community Hub.
  2. Key Generation Wizard:

    • Open a quick connect window, navigate to Authentication, and choose PublicKey.
    • Use the Key Generation Wizard to create an RSA key pair.
  3. Save the Key:

    • Save the new key in “OpenSSH Key format (legacy)” and take note of the filename and its paired public key.

Generating SSH keys with PuTTY:

PuTTY, a popular open-source SSH client, is presented as another option for key generation. The process involves:

  1. Installation of PuTTY:

    • Install PuTTY and open the PuTTYgen app.
  2. Key Generation:

    • Generate an RSA key pair by moving the mouse cursor over the PuTTY Generator window.
  3. Save Keys:

    • Save the public key manually and export the private key in OpenSSH format.

    • To use the key with PuTTY, configure the connection and authentication settings.

Copying your public key to a host:

The article also covers the crucial step of copying the public key to a remote host for authentication. Key points include:

  1. Public Key Format:

    • Public keys are in text format and can be copied using cut and paste commands.
  2. Placement on Remote Hosts:

    • On Unix, Linux, or MacOS machines, the public key is placed in the ~/.ssh/authorized_keys file.
    • On Windows, the key is placed in a text file called authorized_keys in the hidden .ssh folder in the user's directory.
  3. Security Considerations:

    • It emphasizes securing the authorized_keys file by setting it to owner read/write only (mode 600).
  4. Additional Security Measures:

    • Briefly mentions the possibility of restricting connections based on IP addresses or hostnames, though detailed setup is beyond the article's scope.

The comprehensive guide ensures a thorough understanding of SSH key generation and usage on Windows, catering to users of different SSH clients and providing practical insights into securing remote access. The information originates from PhoenixNAP and serves as a valuable resource for individuals looking to enhance their knowledge in SSH key management.

Generating SSH keys with OpenSHH - College of Science (2024)

FAQs

How do I generate a SSH key? ›

For Windows 10 & 11
  1. Press the Windows key or open up the Start Menu. Type “cmd”.
  2. Under “Best Match”, click “Command Prompt”.
  3. In the command prompt, use the ssh-keygen command: ...
  4. The system will now generate the key pair and display the key fingerprint and a randomart image. ...
  5. Open your file explorer.

How to generate key in OpenSSL? ›

Generating a private EC key
  1. Generate an EC private key, of size 256, and output it to a file named key.pem: openssl ecparam -name prime256v1 -genkey -noout -out key.pem.
  2. Extract the public key from the key pair, which can be used in a certificate: openssl ec -in key.pem -pubout -out public.pem read EC key writing EC key.

What is the Ed25519 algorithm for SSH keys? ›

The Ed25519 was introduced on OpenSSH version 6.5. It's the EdDSA implementation using the Twisted Edwards curve. It's using elliptic curve cryptography that offers a better security with faster performance compared to DSA or ECDSA. Today, the RSA is the most widely used public-key algorithm for SSH key.

How to generate SSH keys for remote login? ›

Generate an SSH Key Pair
  1. Run the ssh-keygen command. You can use the -t option to specify the type of key to create. ...
  2. The command prompts you to enter the path to the file in which you want to save the key. ...
  3. The command prompts you to enter a passphrase. ...
  4. When prompted, enter the passphrase again to confirm it.

How to generate RSA key? ›

Generate RSA Keys
  1. Open a shell using Putty or another utility.
  2. Use commands to generate an RSA key file. Type the following command to generate RSA keys: ssh-keygen -t rsa. ...
  3. Navigate to the. rsakey. folder that you created in step 2b. ...
  4. Locate the public key beginning with. ssh. and copy the key.

How to create an SSH key with certificate? ›

  1. Step 1: Generate SSH Key Pair. Open a terminal on your local machine. Run the command: ...
  2. Step 2: Copy the Public Key to the Server. Use the following command to copy your public key to the server: ssh-copy-id user@your_server. ...
  3. Step 3: Verify SSH Key Authentication. Attempt to SSH into the server: ssh user@your_server.
Mar 8, 2024

What is the best SSH key generation? ›

To generate a robust SSH key, you have two main options: ED25519 and RSA. Both have their advantages, but ED25519 is generally recommended for its security and performance benefits.

What is the best practice for SSH keys? ›

It should never be shared or transmitted over insecure networks. Consider encrypting private keys with a passphrase for additional security. Rotate SSH keys. Just like passwords, SSH keys should be changed or rotated regularly to reduce the risk of a key being used maliciously if it's compromised and unnoticed.

Does OpenSSL support ed25519? ›

Ed25519 and Ed448 can be tested with the openssl-speed(1) application since version 1.1. 1. Valid algorithm names are ed25519, ed448 and eddsa. If eddsa is specified, then both Ed25519 and Ed448 are benchmarked.

Is ed25519 better than RSA? ›

ED25519 is generally considered more secure and efficient than RSA, while RSA provides a higher level of security due to its larger key size. The choice between these two algorithms depends on the specific application and the level of security and efficiency required.

How do I generate SSH keys with another user? ›

You can generate the keys for another user the exact same way. You just write them into the appropriate place into the users home directory, ~/. ssh . Then set the permissions on the key files appropriately.

How to generate SSH key and copy to remote server? ›

Copy the ssh key into remote servers
  1. Open a terminal on your local computer.
  2. Generate an SSH key pair if you haven't already done so by running the command: ssh-keygen . ...
  3. Once the key pair is generated, run the command: ssh-copy-id user@remote_server . ...
  4. You'll be prompted to enter the password for the remote user account.
Apr 8, 2023

How to generate SSH key windows terminal? ›

Whether you use Command Prompt or Windows Terminal, type ssh-keygen and hit Enter. This will automatically generate the SSH keys. In our tests on Windows 11, it created a 2048-bit RSA key. If you'd like to use a different algorithm — GitHub recommends Ed25519, for example — then you'd type ssh-keygen -t ed25519 .

How do I find my SSH key? ›

Checking for existing SSH keys
  1. Open Terminal .
  2. Enter ls -al ~/.ssh to see if existing SSH keys are present. $ ls -al ~/.ssh # Lists the files in your .ssh directory, if they exist.
  3. Check the directory listing to see if you already have a public SSH key. ...
  4. Either generate a new SSH key or upload an existing key.

How to get SSH key from terminal? ›

Creating SSH Keys (Terminal)
  1. Create an .ssh folder in the home directory. Create a .ssh folder in your user account's home directory if it doesn't already exist: $ mkdir /home/<user name>/.ssh. ...
  2. Use ssh-keygen to generate SSH key. ...
  3. Retrieve the public key file. ...
  4. Use the key in an async session.

How do I get a public SSH key? ›

To generate an SSH private/public key pair for your use, you can use the ssh-keygen command-line utility. You can run the ssh-keygen command from the command line to generate an SSH private/public key pair. If you are using Windows, by default you may not have access to the ssh-keygen command.

Top Articles
SWEET32 attack
Helping the Homeless on a Budget
Costco Gas Barstow
How To Use Scarabs Poe
Restaurants Near Applebee's
7025825949
The 10 Hardest Video Games Of All Time
Pa Speedtest Rcn Merlin
TCP and UDP ports used by Apple software products - Apple Support
Generation Zero - Weapon Locations Guide - Gamer Tag Zero
Craigslist Illinois Bloomington
7 Best Dialysis Technician Resume Examples for 2024
Why Are People Getting Rid of Air Fryers?
450 Miles Away From Me
Queens University of Charlotte
florence, SC general for sale - craigslist
Joy Ride 2023 Showtimes Near Amc Ward Parkway
Ohio Road Construction Map
Bj Alex Mangabuddy
1-877-793-4268
Www.craigslist.com Omaha
No Hard Feelings Showtimes Near Pullman Village Centre Cinemas
BWW Interview: Marilu Henner Talks THE MARILU HENNER SHOW, Her Highly Superior Autobiographical Memory & More!
Jamie Soricelli Friend Kelly Courtney
Sign of the times: Emma Memma finds her calling after Wiggles
Humbled And Subjugated Breeding Machine
Magma Lozenge Location
Soap2Day.qc
sarai Reader- 08: Fear - PDF Free Download
Ucc Aeorion
55 Farmer-Approved Recipes
Death On 14 Freeway Today
Comcast Business Downdetector
Sydney V May Of Leaked
First Financial Credit Union In Rio Rancho
David Baker, biochemist: ‘Now we can build completely new proteins to do exactly what we want’
Lawrence Ks Police Scanner
Https Ltsrvext Lowes Com Lowesmobile
Latest Mugshots In St Lucie County
Salons Open Near Me Today
Walmart Tire Center Tooele
Welcome to SportsLine! - SportsLine.com
Amazon Gru Costume
Weitere relevante internationale Abkommen und Vereinbarungen
Summer in South Korea | University of Nevada, Reno
Sams Manage Credit Card
First Mess Blog
The Emergent Care Clinic Hesi Case Study
Fhnb Pay Calendar
Latest Posts
Article information

Author: Patricia Veum II

Last Updated:

Views: 6373

Rating: 4.3 / 5 (44 voted)

Reviews: 91% of readers found this page helpful

Author information

Name: Patricia Veum II

Birthday: 1994-12-16

Address: 2064 Little Summit, Goldieton, MS 97651-0862

Phone: +6873952696715

Job: Principal Officer

Hobby: Rafting, Cabaret, Candle making, Jigsaw puzzles, Inline skating, Magic, Graffiti

Introduction: My name is Patricia Veum II, I am a vast, combative, smiling, famous, inexpensive, zealous, sparkling person who loves writing and wants to share my knowledge and understanding with you.