Generating SSH keys (2024)

This content has been archived, and is no longer maintained by Indiana University. Information here may no longer be accurate, and links may no longer be available or reliable.

To gain access to various online services,you may need to obtain an SSH key. To find more out aboutOpen SSH, see the Open SSHManual pages. To generate and send such a key, see the sectionsbelow.

On this page:

  • Working with SSH keys
    • Generating a public/private key pair
    • Listing the result
    • Adding or replacing a passphrase for an existing key
    • Resetting an SSH key
  • Other resources for SSH keys

Working with SSH keys

Generating a public/private key pair

To generate a key:

  1. Enter the command ssh-keygen -t rsa -C your emailaddress.
  2. Specify the KeyPair location and name. Administrators recommendyou use the default location if you do not yet have another key there,for example:/home/username/.ssh/id_rsa.
  3. When prompted, type your user-defined passphrase for the key.

Example input and output follows:

ssh-keygen -t rsa -C [email protected]
Generating public/private rsa key pair.
Enter file in which to save the key (/home/johndoe/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/johndoe/.ssh/id_rsa.
Your public key has been saved in /home/johndoe/.ssh/id_rsa.pub.
The key fingerprint is:
34:87:67:ea:c2:49:ee:c2:81:d2:10:84:b1:3e:05:59 [email protected]

Listing the result

You can find your key under the key location in the .ssh directory,as follows:

$ls -lisa ~/.ssh
-rw------- 1 johndoe johndoe 1743 2011-02-10 09:44 id_rsa
-rw-r--r-- 1 johndoe johndoe 399 2011-02-10 09:44 id_rsa.pub

Adding or replacing a passphrase for anexisting key

To change your passphrase, you can simply run the ssh-keygen-p command. Specify the location of your current key, and inputany old or new passphrases. There is no need to regenerate keys.

ssh-keygen -p
Enter file in which the key is (/home/johndoe/.ssh/id_rsa):
Enter old passphrase:
Key has comment '/home/johndoe/.ssh/id_rsa'
Enter new passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved with the new passphrase.

Resetting an SSH key

To reset a key, see How doI reset/change my SSH key?

Other resources for SSH keys

Generating SSH keys (2024)

FAQs

What is the recommended 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.

How to generate SSH keys? ›

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.

What is the best SSH key algorithm? ›

We strongly recommend using only the ed25519 algorithm (an ECDSA variant). It is the most secure SSH key type widely available, and is very well supported in the majority of systems. If you are using an client or server without ed25519 support, you should consider upgrading where possible.

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.

Do I need to generate a new SSH key every time? ›

If your key has a passphrase and you don't want to enter the passphrase every time you use the key, you can add your key to the SSH agent. The SSH agent manages your SSH keys and remembers your passphrase. If you don't already have an SSH key, you must generate a new SSH key to use for authentication.

Who should generate SSH key? ›

Typically a system administrator would first create a key using ssh-keygen and then install it as an authorized key on a server using the ssh-copy-id tool. See also the dedicated page on configuring authorized keys for OpenSSH. We recommend using passphrases for all identity keys used for interactive access.

How to generate SSH key automatically? ›

Generating a SSH key

From the SSH section, select Create SSH Key. In the Create SSH Key dialog, enter a Key Name and then select Create Key. The private and public SSH key pairs generate.

How to generate SSH keys for remote login? ›

To generate an SSH key on your Linux server, run the command ssh-keygen . The command can take flags if you would like to customize the type of key that is generated and the signing algorithms that are used to generate the key. This example generates a standard 2048-bit RSA key without a passphrase.

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.

What is the best format for SSH keys? ›

In most cases, 2048-bit keys are secure and generally recommended. If you need higher security, such as for critical infrastructure or storing sensitive data, consider using longer keys (3072 or 4096 bits).

What is the strongest key algorithm? ›

Strongest Data Encryption Algorithms
  • TripleDES.
  • Twofish encryption algorithm.
  • Blowfish encryption algorithm.
  • Advanced Encryption Standard (AES)
  • IDEA encryption algorithm.
  • MD5 encryption algorithm.
  • HMAC encryption algorithm.
  • RSA security.
Jan 17, 2020

What is the fastest SSH algorithm? ›

arcfour is the fastest cipher, and aes128-cbc is faster than the default aes128-ctr. Note that blowfish-cbc is not particularly fast. ssh is faster than netcat using either the aes128-cbc or arcfour ciphers.

Is SSH RSA obsolete? ›

The SSH-RSA is a weak encryption method. It is also already deprecated by OpenSSH and cannot be used unless enabled explicitly. This change impacts you immediately if you are using Azure DevOps Service and are using SSH-RSA keys to connect to repos through SSH.

Is RSA key obsolete? ›

Key Takeaways

Microsoft is discontinuing Windows RSA keys shorter than 2048 bits to encourage the adoption of more robust encryption techniques for server authentication. Since 2013, internet standards and regulatory bodies have prohibited using 1024-bit keys, recommending 2048 bits or longer RSA keys.

What are the disadvantages of Ed25519? ›

The only downside to Ed25519 is that it will fall to quantum computing before RSA 4096. Except nobody knows when that's gonna really happen. I've personally switched to ed25519-sk wherever I could. Same, the short key looks much nicer and both will fall to quantum anyhow.

Should I use ECDSA or ed25519? ›

EdDSA Keys (Ed25519 & Ed448)

It provides equivalent and usually better security than ECDSA and longer key length RSA keys. Its main advantages are small key sizes, fast key generation times, high performance and is resistance against side-channel attacks. Something to note though is its compatibility.

What is the best key format for SSH? ›

Only three key sizes are supported: 256, 384, and 521 (sic!) bits. We would recommend always using it with 521 bits, since the keys are still small and probably more secure than the smaller keys (even though they should be safe as well). Most SSH clients now support this algorithm.

Which version of SSH should I use? ›

The encryption involved in SSH version 1 is weak enough for a middleman to decrypt it, view the contents, and even modify it without both parties knowing about it. Thus, make sure to use SSH version 2 both on the client-side, as well as enforce the same on the server-side.

What are the recommended SSH key permissions? ›

ssh directory permissions should be 700 (drwx------). The public key (. pub file) should be 644 (-rw-r--r--). The private key (id_rsa) on the client host, and the authorized_keys file on the server, should be 600 (-rw-------).

Top Articles
Passphrase | What is a Passphrase
Total Crypto Market Cap — Index Chart — TradingView
Mickey Moniak Walk Up Song
Craigslist Warren Michigan Free Stuff
Cold Air Intake - High-flow, Roto-mold Tube - TOYOTA TACOMA V6-4.0
Jackerman Mothers Warmth Part 3
Mr Tire Prince Frederick Md 20678
O'reilly's In Monroe Georgia
Merlot Aero Crew Portal
Umn Pay Calendar
Guardians Of The Galaxy Vol 3 Full Movie 123Movies
iLuv Aud Click: Tragbarer Wi-Fi-Lautsprecher für Amazons Alexa - Portable Echo Alternative
State HOF Adds 25 More Players
Telegram Scat
Moviesda3.Com
Wisconsin Women's Volleyball Team Leaked Pictures
Troy Bilt Mower Carburetor Diagram
Parentvue Clarkston
Craigslist Sparta Nj
Concordia Apartment 34 Tarkov
Ahrefs Koopje
Talk To Me Showtimes Near Marcus Valley Grand Cinema
Baldur's Gate 3: Should You Obey Vlaakith?
eugene bicycles - craigslist
Essence Healthcare Otc 2023 Catalog
Best Middle Schools In Queens Ny
1773x / >
Violent Night Showtimes Near Johnstown Movieplex
2023 Ford Bronco Raptor for sale - Dallas, TX - craigslist
Have you seen this child? Caroline Victoria Teague
Kaiju Paradise Crafting Recipes
Σινεμά - Τι Ταινίες Παίζουν οι Κινηματογράφοι Σήμερα - Πρόγραμμα 2024 | iathens.gr
Greencastle Railcam
The Land Book 9 Release Date 2023
Flashscore.com Live Football Scores Livescore
The best Verizon phones for 2024
Bella Thorne Bikini Uncensored
Kelley Blue Book Recalls
Htb Forums
Citibank Branch Locations In Orlando Florida
SF bay area cars & trucks "chevrolet 50" - craigslist
Rage Of Harrogath Bugged
Gli italiani buttano sempre più cibo, quasi 7 etti a settimana (a testa)
Greg Steube Height
Sandra Sancc
Myra's Floral Princeton Wv
Pas Bcbs Prefix
Meee Ruh
Mytmoclaim Tracking
Erica Mena Net Worth Forbes
Gelato 47 Allbud
Shad Base Elevator
Latest Posts
Article information

Author: Msgr. Benton Quitzon

Last Updated:

Views: 6174

Rating: 4.2 / 5 (43 voted)

Reviews: 90% of readers found this page helpful

Author information

Name: Msgr. Benton Quitzon

Birthday: 2001-08-13

Address: 96487 Kris Cliff, Teresiafurt, WI 95201

Phone: +9418513585781

Job: Senior Designer

Hobby: Calligraphy, Rowing, Vacation, Geocaching, Web surfing, Electronics, Electronics

Introduction: My name is Msgr. Benton Quitzon, I am a comfortable, charming, thankful, happy, adventurous, handsome, precious person who loves writing and wants to share my knowledge and understanding with you.