The Guide to Generating and Uploading SSH Keys (2024)

An SSH key is a form of authentication in the SSH protocol. It is similar to a password, but allows for authentication without entering in a password or any manual input. SSH keys generally speaking are more secure, and convenient than password authentication.

Command Line

If you currently have access to SSH on your server, you can generate SSH keys on the command line using thessh-keygenutility which is installed by default on our servers. Run it on your server with no options, or arguments to generate a 2048-bit RSA key pair (which is plenty secure).

$ ssh-keygen

You will be prompted to select a file for the key pair. The default directory for SSH keys is~/.sshwith the private key namedid_rsaand the public key namedid_rsa.pub. By using the default file names, the SSH client will be able to automatically locate the keys during authentication so it is strongly recommended to not change them. You can use the default by pressing the Enter key.

Generating public/private rsa key pair. Enter file in which to save the key (/home/USER/.ssh/id_rsa):

If /home/USER/.ssh/id_rsa or a key of the name you chose already exists, you will be prompted to overwrite the keys. If you do overwrite the existing keys, you will not be able to use them to authenticate anymore.

After you have selected the file for the key pair, you be will be prompted to enter a passphrase to encrypt private key file. Encrypting the private key with a passphrase isoptional, but it will improve security the keys. If you enter a passphrase you will have to provide each it time you use the key. You can press the Enter key to not use a passphrase; we strongly recommend the use of a passphrase with SSH keys.

Created directory '/home/USER/.ssh'. Enter passphrase (empty for no passphrase): Enter same passphrase again: 

A public and private key will now be generated.

Your identification has been saved in /home/USER/.ssh/id_rsa. Your public key has been saved in /root/.ssh/id_rsa.pub. The key fingerprint is: SHA256:boo2WmwU41qy/IxmJCgDjjsg7xvvcXmHhHa7BKhoCPY root@server.domain.tld The key's randomart image is: +---[RSA 2048]----+ | | |o | |+. . . . | |=o. o . + o | |O+.. = .S= o | |X=oEo o.o = + | |*+= . ooo o | |oO+. ..o . | |*+.+. . | +----[SHA256]-----+

WHM

You can generate SSH key pairs forrootinWHM >> Home Security Center >> Manage root's SSH Keys.

The Guide to Generating and Uploading SSH Keys (1)

ClickGenerate a New Keyto get started.

The Guide to Generating and Uploading SSH Keys (2)

There are several fields on this page:Key Name,Key Password,Key Type, andKey Size.

The Guide to Generating and Uploading SSH Keys (3)

The defaultKey Nameisid_rsa. Keys are generated in/root/.ssh/so the default key name would create a private key in/root/.ssh/id_rsa, and a public key in/root/.ssh/id_rsa.pub. Using the default name will allow SSH clients to automatically locate the keys so it is strongly recommend you use the default name (simply leave the field blank or fill it withid_rsa).

The Guide to Generating and Uploading SSH Keys (4)

TheKey Passwordencrypts the private key file using a password to add an extra layer of security. The password must be provided each time the key is used for authentication to decrypt the private key. ThePassword Strengthfield indicates how strong your password is. 0 indicates a very weak password, and 100 indicates a very strong password. ClickPassword Generatorto have a strong password generated for you.

Key TypeandKey Sizeare RSA and 2048 by default, and are secure enough for most purposes so these can be left alone.

The Guide to Generating and Uploading SSH Keys (5)

ClickGenerate Keyto generate the SSH key pair. WHM will then display the location of the key.

The Guide to Generating and Uploading SSH Keys (6)PuTTY

PuTTY is an open Windows SSH client. You will need to have the PuTTYgen utility installed to generate an SSH key pair. PuTTYgen is included in Windows installer on theDownload PuTTYsite, but you can download it separately if you installed PuTTY without its extra utilities. SeeConnect using PuTTY to a Linux Serverto learn more about PuTTY.

Open PuTTYgen.

The Guide to Generating and Uploading SSH Keys (7)

TheParametersat the bottom can be adjusted to affect how secure the key is, but the default options are plenty secure for most purposes.

The Guide to Generating and Uploading SSH Keys (8)

If you're satisfied with the parameters, clickGenerateinActionsto generate the key pair.

The Guide to Generating and Uploading SSH Keys (9)

You may be asked to "generate some randomness by moving the mouse over the blank area" to generate the key. The randomness is used to generate your keys securely, and make it difficult to reproduce them.

The Guide to Generating and Uploading SSH Keys (10)

Once the key is generated, you will see the public key in PuTTYgen.

The Guide to Generating and Uploading SSH Keys (11)

TheKey passphrasefield sets a password used to decrypt the private the key. This field is optional, and the private key will not be encrypted if it is omitted.Using a passphrase increases the security of your SSH keys, and we strongly recommend setting one.

Be sure to save both the public and private keys on your local machine so they can be used by PuTTY for authentication in the future by clicking theSave public keyandSave private keybuttons.

The Guide to Generating and Uploading SSH Keys (12)

If you don't use a passphrase, it will prompt you to confirm before allowing you to save the private key. The private key will be saved as a.ppkfile. The public key isn't given an extension by default, but.pubis a common extension for public key files. It can be saved as a.txtfile as well as the public key file only stores the public key in plain text.

Command Line

If you currently have access to SSH on your server, you can upload the key over the command line.

Retrieve the contents of the public key. If the key was created in the default location, this can be done by outputting the contents of~/.ssh/id_rsa.pub.

$ cat ~/.ssh/id_rsa.pub

The output will look similar to the following:

ssh-rsa AAAAB9NzaC1yc2EAAAADAQABAAABAQDBej/3XAjhwTwWXsOJmDdKTLtjnpGXsHOAEIYC12qQ r51+AVJPNsqcDlFdv+Lr/XufQDCh2gXz+ieA/LJNb5luxReaVVbKtvAONZgv8uLD1J8kzRXike3h9L53 oIo2j8Lt4fuzB8yAWkwBelurn4OWfk0K6gFXN86RgprKSPN3GbwG6MINAor7NwCHzJhVK9u6Jpw9EPJv Dl4co+N9L+CGgudvY7iBNzIofE9MP68lXcql4bMWz3+2H0FWKHZ1rSJz56KjoCKBPWTqdFq5o1AIcauc ECgiTaEGcSNk4+T0A8BuAOd3a4O9Gr6y8C4Sn4ghYajJVWsszP2B1tTGAc3L

Open the (and create if it doesn't exist)~/.ssh/authorized_keysfile using a text editor such asnano,pico, orvim.

$ nano ~/.ssh/authorized_keys

If you had to create the ~/.ssh/ directory, or the authorized_keys file, you need to verify the permissions are correct, or you won't be able to login.

$ chmod 700 ~/.shh
$ chmod 600 ~/.ssh/authorized_keys

Paste the public key at the bottom of the file, and then save and close the file.

Alternatively, you can append the public key to~/.ssh/authorized_keyswith a single command.

You can use thecatcommand if the public key is stored in a file.

$ cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys

If the public key is not stored as a file on the server, you can use theechocommand.

$ echo "ssh-rsa AAAAB9N...sszP2B1tTGAc3L" >> ~/.ssh/authorized_keys

Be sure to includethe entire public key in quotes afterecho.

Once the public key is added to theauthorized_keysfile, you should be able to login using your SSH keys.

WHM

You can import an existing SSH key forrootinWHM >> Home Security Center >> Manage root's SSH Keys.

The Guide to Generating and Uploading SSH Keys (13)

ClickImport Key.

The Guide to Generating and Uploading SSH Keys (14)

The next page has a few fields to fill in.

The Guide to Generating and Uploading SSH Keys (15)

You need to name the SSH key in theChoose a name for this keyfield. The default key name isid_rsa.Using the default name will allow SSH clients to automatically locate the keys so it is strongly recommend you use the default name (simply leave the field blank or fill it withid_rsa).

The Guide to Generating and Uploading SSH Keys (16)

If you are importing a PPK (PuTTYgen key) file, enter its password (if applicable) in thePrivate key passphrasetext box.

The Guide to Generating and Uploading SSH Keys (17)

Paste the publickey into the appropriate box, but donotpaste the private key into the box; private keys should always remain on the servers that generated them.

The Guide to Generating and Uploading SSH Keys (18)

ClickImport.

The Guide to Generating and Uploading SSH Keys (19)

WHM will display the name of the keys imported, from there you will need to authorize the SSH key you just imported by clicking "Manage Authorization" and "Authorize". Once you have authorized the key you should now be able to authenticate over SSH using the key.

The default name for SSH key pairs isid_rsa, and that name will allow an SSH client to locate the key automatically. When an SSH key pair doesn't use the default name, you will need to specify the name of key used.

$ ssh user@server.domain.tld -i /path/to/ssh/key
The Guide to Generating and Uploading SSH Keys (2024)

FAQs

How to generate SSH key step by step? ›

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 do I upload an SSH key? ›

How to add new SSH key to a cloud server
  1. Connect to the server using your current key. ssh cloud-user@1.2.3.4 -i /current_private_ssh_key.
  2. Add a public key to the "authorized_keys" file. You can add a public key to the "authorized_keys" file using "nano" text editor (or any text editor of your choice): ...
  3. Verify new key.

How to generate and add SSH key in Git? ›

Generating a new SSH key
  1. Open Terminal .
  2. Paste the text below, replacing the email used in the example with your GitHub email address. ssh-keygen -t ed25519 -C "your_email@example.com" ...
  3. At the prompt, type a secure passphrase. For more information, see "Working with SSH key passphrases."

What does generating an SSH key do? ›

SSH key pairs offer a more secure way of logging into your server than a password that can easily be cracked with a dictionary and brute force attacks.

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 generate SSH key in command prompt? ›

Creating SSH Keys (Command Line)
  1. Create a .ssh in your home directory. Create a .ssh folder in your user account's home directory if it does not exist: $ mkdir /home/username/.ssh. ...
  2. Run ssh-keygen to generate an SSH key-pair. ...
  3. Retrieve the public key file. ...
  4. Start a transfer using public key authentication with the ascp command.

How do I generate a SSH key for a remote server? ›

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 do I upload a key? ›

Create an upload key and update keystores
  1. Follow the instructions on the Android Developers site. Store your key in a safe place.
  2. Export the certificate for the upload key to PEM format. ...
  3. When prompted during the release process, upload the certificate to register it with Google.

How do I create a key file for SSH? ›

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 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 does a SSH key look like? ›

Functionally SSH keys resemble passwords. They grant access and control who can access what. In identity and access management, they need similar policies, provisioning, and termination as user accounts and passwords.

How to generate two SSH keys? ›

Table of Contents
  1. Step 1: Double-check if you have an existing SSH key. ...
  2. Step 2a: If you don't have an existing SSH key, generate a new SSH key. ...
  3. Step 2b: Save the SSH key in the according file of your choice. ...
  4. Step 3: Adding the SSH to the ssh-agent. ...
  5. Step 4: Add your SSH private key to the ssh-agent.

How do I know if my SSH key is generated? ›

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.

What tool generates SSH key? ›

ssh-keygen is a command-line tool that is used to generate, manage, and convert SSH authentication keys. As of Windows 10, the OpenSSH client is included by default, which means you can use it directly from the Command Prompt or PowerShell.

What is an SSH key for dummies? ›

An SSH key is a secure access credential used in the Secure Shell (SSH) protocol. SSH key pairs use public key infrastructure (PKI) technology, the gold standard for digital identity authentication and encryption, to provide a secure and scalable method of authentication.

How to generate SSH key through PuTTY? ›

Generating SSH key pairs locally
  1. Download PuTTYgen (available here) and run the executable.
  2. Click on the Generate button and follow on-screen instructions.
  3. Create and confirm a Key passphrase.
  4. Save public and private keys. Saving the public key with the extension . ...
  5. Upload the public key file.

How do I generate a SSH key for Devops? ›

The easiest way to generate SSH key pair is to click the Generate new SSH key button in the Valohai web app. Go to Valohai and navigate to the repository settings in your Valohai Project through Settings > Repository. Click on the “Generate SSH Key” button.

How to create SSH deploy key? ›

Set up deploy keys
  1. Run the ssh-keygen procedure on your server, and remember where you save the generated public and private rsa key pair.
  2. On GitHub.com, navigate to the main page of the repository.
  3. Under your repository name, click Settings. ...
  4. In the sidebar, click Deploy Keys.
  5. Click Add deploy 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

Top Articles
$600,000 Will Buy You This Much Retirement
13 of the World's Most Curious Money Superstitions
What Is Single Sign-on (SSO)? Meaning and How It Works? | Fortinet
Victor Spizzirri Linkedin
Play FETCH GAMES for Free!
4-Hour Private ATV Riding Experience in Adirondacks 2024 on Cool Destinations
Asian Feels Login
Is Csl Plasma Open On 4Th Of July
Hello Alice Business Credit Card Limit Hard Pull
Turbocharged Cars
Mid90S Common Sense Media
Washington Poe en Tilly Bradshaw 1 - Brandoffer, M.W. Craven | 9789024594917 | Boeken | bol
Leeks — A Dirty Little Secret (Ingredient)
Raleigh Craigs List
Mini Handy 2024: Die besten Mini Smartphones | Purdroid.de
24 Hour Walmart Detroit Mi
Morgan And Nay Funeral Home Obituaries
Available Training - Acadis® Portal
Bfg Straap Dead Photo Graphic
Kitty Piggy Ssbbw
Voy Boards Miss America
Spoilers: Impact 1000 Taping Results For 9/14/2023 - PWMania - Wrestling News
Ups Access Point Lockers
Tygodnik Polityka - Polityka.pl
Charter Spectrum Store
Talbots.dayforce.com
Axe Throwing Milford Nh
Gentle Dental Northpointe
Jet Ski Rental Conneaut Lake Pa
Mini Handy 2024: Die besten Mini Smartphones | Purdroid.de
Getmnapp
Webworx Call Management
Enduring Word John 15
Penn State Service Management
Vip Lounge Odu
Why Are The French So Google Feud Answers
Life Insurance Policies | New York Life
Acuity Eye Group - La Quinta Photos
Craigslist Neworleans
Viewfinder Mangabuddy
Bismarck Mandan Mugshots
Weather Underground Bonita Springs
Questions answered? Ducks say so in rivalry rout
2132815089
At Home Hourly Pay
Smite Builds Season 9
Winta Zesu Net Worth
Ssc South Carolina
Strawberry Lake Nd Cabins For Sale
Dumb Money Showtimes Near Regal Stonecrest At Piper Glen
Asisn Massage Near Me
Latest Posts
Article information

Author: Melvina Ondricka

Last Updated:

Views: 5444

Rating: 4.8 / 5 (48 voted)

Reviews: 87% of readers found this page helpful

Author information

Name: Melvina Ondricka

Birthday: 2000-12-23

Address: Suite 382 139 Shaniqua Locks, Paulaborough, UT 90498

Phone: +636383657021

Job: Dynamic Government Specialist

Hobby: Kite flying, Watching movies, Knitting, Model building, Reading, Wood carving, Paintball

Introduction: My name is Melvina Ondricka, I am a helpful, fancy, friendly, innocent, outstanding, courageous, thoughtful person who loves writing and wants to share my knowledge and understanding with you.