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
The best ad blockers in 2024
Tick safety 101: how to check for ticks
Rubratings Tampa
Gamevault Agent
What to Do For Dog Upset Stomach
Asian Feels Login
Truist Park Section 135
Lycoming County Docket Sheets
Declan Mining Co Coupon
No Credit Check Apartments In West Palm Beach Fl
Jessica Renee Johnson Update 2023
Sams Gas Price Fairview Heights Il
065106619
Q33 Bus Schedule Pdf
Dirt Removal in Burnet, TX ~ Instant Upfront Pricing
All Obituaries | Buie's Funeral Home | Raeford NC funeral home and cremation
The Pretty Kitty Tanglewood
Persona 5 Royal Fusion Calculator (Fusion list with guide)
Acts 16 Nkjv
All Obituaries | Gateway-Forest Lawn Funeral Home | Lake City FL funeral home and cremation Lake City FL funeral home and cremation
Jayah And Kimora Phone Number
27 Modern Dining Room Ideas You'll Want to Try ASAP
Jazz Total Detox Reviews 2022
Keshi with Mac Ayres and Starfall (Rescheduled from 11/1/2024) (POSTPONED) Tickets Thu, Nov 1, 2029 8:00 pm at Pechanga Arena - San Diego in San Diego, CA
Roseann Marie Messina · 15800 Detroit Ave, Suite D, Lakewood, OH 44107-3748 · Lay Midwife
Guinness World Record For Longest Imessage
Myaci Benefits Albertsons
Little Einsteins Transcript
My Dog Ate A 5Mg Flexeril
Vip Lounge Odu
+18886727547
James Ingram | Biography, Songs, Hits, & Cause of Death
Dtlr On 87Th Cottage Grove
Swimgs Yuzzle Wuzzle Yups Wits Sadie Plant Tune 3 Tabs Winnie The Pooh Halloween Bob The Builder Christmas Autumns Cow Dog Pig Tim Cook’s Birthday Buff Work It Out Wombats Pineview Playtime Chronicles Day Of The Dead The Alpha Baa Baa Twinkle
Yoshidakins
Suspect may have staked out Trump's golf course for 12 hours before the apparent assassination attempt
Navigating change - the workplace of tomorrow - key takeaways
Uhaul Park Merced
Montrose Colorado Sheriff's Department
Craigslist Lakeside Az
Bella Thorne Bikini Uncensored
Telugu Moviez Wap Org
Puretalkusa.com/Amac
Mid America Irish Dance Voy
60 X 60 Christmas Tablecloths
Restored Republic June 6 2023
Quick Base Dcps
John M. Oakey & Son Funeral Home And Crematory Obituaries
Bridgeport Police Blotter Today
2487872771
Divisadero Florist
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.