How to generate a secure and robust SSH key in 2024 (2024)

How to generate a secure and robust SSH key in 2024 (1)

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.

Here's how to generate each type of key:

Generating an ED25519 Key

ED25519 keys are considered more secure and performant than RSA keys. They are compact, fast to generate, and offer better security with faster performance compared to DSA or ECDSA. To generate an ED25519 key, use the following command:

ssh-keygen -t ed25519 -C "<comment>"

Replace with a meaningful comment, such as your email address. This comment won't be exposed outside your machine. Consider it as a label to identify your ssh key.

This command generates an ED25519 key pair and saves it in the default .ssh directory within your home directory.

You'll be prompted to enter a passphrase for the key, which adds an extra layer of security.

Generating an RSA Key

If you prefer to use RSA, it's recommended to use a key size of at least 2048 bits for security. However, a 4096-bit key is even more secure and is recommended if you're concerned about the future of cryptographic security. To generate an RSA key with a 4096-bit size, use the following command:

ssh-keygen -t rsa -b 4096 -C "<comment>"

Additional Considerations

  • Security: ED25519 keys are more secure against PRNG (Pseudo-Random Number Generator) failures, making them a robust choice for SSH keys.
  • Performance: ED25519 keys are faster and more efficient than RSA keys, which can be a significant advantage in environments with high security requirements 2.

  • Compatibility: Ensure your system supports the key type you choose. ED25519 is supported in OpenSSH version 6.5 and later, while RSA keys are widely supported across all versions 2.

To check your ssh version, you can run the following command

$ ssh -VOpenSSH_8.9 ...

Please note the ssh servers you log are the ones that need to support ED25519 keys, so please make sure to check on them before trying anything.

TL;DR; For generating a robust SSH key, ED25519 is generally the preferred choice due to its security and performance benefits. However, RSA keys with a 4096-bit size are also a secure option if you have specific compatibility requirements or preferences.

Top comments (2)

Subscribe

How to generate a secure and robust SSH key in 2024 (10)

cr0t0

  • Joined

Great series of articles about git. Once the key pair has been generated, is it a good idea to change the permissions of directories and folders? For example chmod 700 && chmod 600 ~/.ssh/* && chmod 644 ~/.ssh/*.pub. Thx!

How to generate a secure and robust SSH key in 2024 (12)

Christophe Colombier

Smiling person, father of two, Husband, Senior Developer/Architect (in that exact order, it's important)Experience in development since 2004Linux user and advocate since 2001

  • Location

    Villeurbanne, France

  • Education

    Arts et Métiers

  • Work

    VP Technology

  • Joined

I think it's the default behavior of ssh-keygen 🤔

For further actions, you may consider blocking this person and/or reporting abuse

How to generate a secure and robust SSH key in 2024 (2024)

FAQs

How to generate a secure and robust SSH key in 2024? ›

ssh key (3 Part Series)

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

How do I generate a modern SSH key? ›

You can generate keys with the 'ssh-keygen' command: $ ssh-keygen -t ed25519 Generating public/private ed25519 key pair. Enter file in which to save the key ($HOME/. ssh/id_ed25519): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in $HOME/.

Is ed25519 more secure than RSA? ›

The Ed25519 key is much shorter, so initially you might think it is less secure. But these keys use a totally different algorithm, so although the key has fewer characters, it is, for all practical purposes, as secure as the RSA key above.

How to generate SSH 256 key? ›

How to Create SSH Keys
  1. Open Terminal.
  2. Run this command: ssh-keygen -t rsa.
  3. When you execute the command, the ssh-keygen utility prompts you to enter the name of the file you want the key to be stored in. ...
  4. Type in a passphrase when prompted.
Aug 21, 2024

What is the best SSH key for 2024? ›

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 do I make SSH more secure? ›

Here are some best practices to ensure your authentication bulwark is as strong as it can be:
  1. Require strong passwords. ...
  2. Enable two-factor authentication. ...
  3. Regularly update passwords. ...
  4. Implement account lockouts. ...
  5. Educate users. ...
  6. Use SSH keys.

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 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.

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.

How to generate an ECDSA key? ›

Generate ECDSA keys
  1. Create a private key. openssl ecparam -name secp256k1 -genkey -noout -out ec-secp256k1-priv-key.pem. ...
  2. Create a public key by extracting it from the private key. openssl ec -in ec-secp256k1-priv-key.pem -pubout > ec-secp256k1-pub-key.pem.

How to generate ECDSA sha2 nistp256 key? ›

Steps:
  1. In PuttyGen, choose the Key Type as ECDSA and the Curve as nistp256:
  2. Generate the KeyPair and save the highlighted public key (similar to the screenshot below) in a text file: ...
  3. To save the private key, choose the conversions option on the top and choose "Export OpenSSH Key":
Mar 11, 2023

How to generate SSH private key? ›

Generating a Secure Shell (SSH) Public/Private Key Pair
  1. Navigate to your home directory: ...
  2. Run the ssh-keygen utility, providing as filename your choice of file name for the private key: ...
  3. Enter a passphrase for the private key, or press Enter to create a private key without a passphrase:

Is ECDSA more secure than RSA? ›

Security. Both RSA and ECDSA can be configured to provide equal security levels. However, ECDSA requires significantly shorter private and public keys to achieve the same level of security that RSA can provide with long keys.

Which authentication algorithm is most secure? ›

AES (Advanced Encryption Standard) — AES is the strongest encryption algorithm available. Fireware can use AES encryption keys of these lengths: 128, 192, or 256 bits.

What is the best encryption algorithm with key? ›

The Advanced Encryption Standard (AES) is the trusted standard algorithm used by the United States government, as well as other organizations. Although extremely efficient in the 128-bit form, AES also uses 192- and 256-bit keys for very demanding encryption purposes.

Top Articles
Billing Assistant CV Example for 2024 (Skills & Templates)
How to add NFTs to Metamask wallet - Sinergia Media Labs
Access-A-Ride – ACCESS NYC
CLI Book 3: Cisco Secure Firewall ASA VPN CLI Configuration Guide, 9.22 - General VPN Parameters [Cisco Secure Firewall ASA]
Algebra Calculator Mathway
Google Sites Classroom 6X
Kobold Beast Tribe Guide and Rewards
Top 10: Die besten italienischen Restaurants in Wien - Falstaff
Wausau Marketplace
<i>1883</i>'s Isabel May Opens Up About the <i>Yellowstone</i> Prequel
35105N Sap 5 50 W Nit
Samsung 9C8
13 The Musical Common Sense Media
fltimes.com | Finger Lakes Times
Walmart Windshield Wiper Blades
My.tcctrack
2020 Military Pay Charts – Officer & Enlisted Pay Scales (3.1% Raise)
R Personalfinance
Effingham Bookings Florence Sc
Drago Funeral Home & Cremation Services Obituaries
Craigslist Maui Garage Sale
How to Watch the Fifty Shades Trilogy and Rom-Coms
Selfservice Bright Lending
Culver's Flavor Of The Day Taylor Dr
Bella Bodhi [Model] - Bio, Height, Body Stats, Family, Career and Net Worth 
12 Top-Rated Things to Do in Muskegon, MI
Great Clips Grandview Station Marion Reviews
Finding Safety Data Sheets
Lovindabooty
SOGo Groupware - Rechenzentrum Universität Osnabrück
Lbrands Login Aces
Waters Funeral Home Vandalia Obituaries
Cinema | Düsseldorfer Filmkunstkinos
Big Boobs Indian Photos
Pipa Mountain Hot Pot渝味晓宇重庆老火锅 Menu
Angel del Villar Net Worth | Wife
The Mad Merchant Wow
Whitehall Preparatory And Fitness Academy Calendar
Empire Visionworks The Crossings Clifton Park Photos
Craigslist Pets Huntsville Alabama
Legit Ticket Sites - Seatgeek vs Stubhub [Fees, Customer Service, Security]
Saybyebugs At Walmart
Infinite Campus Farmingdale
Martha's Vineyard – Travel guide at Wikivoyage
Southwest Airlines Departures Atlanta
The Average Amount of Calories in a Poke Bowl | Grubby's Poke
How to Find Mugshots: 11 Steps (with Pictures) - wikiHow
Compete My Workforce
Jovan Pulitzer Telegram
Subdomain Finer
라이키 유출
How to Choose Where to Study Abroad
Latest Posts
Article information

Author: Mrs. Angelic Larkin

Last Updated:

Views: 5935

Rating: 4.7 / 5 (67 voted)

Reviews: 82% of readers found this page helpful

Author information

Name: Mrs. Angelic Larkin

Birthday: 1992-06-28

Address: Apt. 413 8275 Mueller Overpass, South Magnolia, IA 99527-6023

Phone: +6824704719725

Job: District Real-Estate Facilitator

Hobby: Letterboxing, Vacation, Poi, Homebrewing, Mountain biking, Slacklining, Cabaret

Introduction: My name is Mrs. Angelic Larkin, I am a cute, charming, funny, determined, inexpensive, joyous, cheerful person who loves writing and wants to share my knowledge and understanding with you.