The Guide to Generating and Uploading SSH Keys (2024)

Table of Contents
Command Line WHM PuTTY Command Line WHM

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 [email protected] 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 [email protected] -i /path/to/ssh/key
The Guide to Generating and Uploading SSH Keys (2024)
Top Articles
Find your Forex entry point: three entry strategies to try
Drag and drop in React List box component
Toa Guide Osrs
Skycurve Replacement Mat
Busted Newspaper Zapata Tx
Brady Hughes Justified
Gamevault Agent
30 Insanely Useful Websites You Probably Don't Know About
Myhr North Memorial
Geodis Logistic Joliet/Topco
Women's Beauty Parlour Near Me
Athletic Squad With Poles Crossword
Crusader Kings 3 Workshop
Washington Poe en Tilly Bradshaw 1 - Brandoffer, M.W. Craven | 9789024594917 | Boeken | bol
Marion County Wv Tax Maps
[Birthday Column] Celebrating Sarada's Birthday on 3/31! Looking Back on the Successor to the Uchiha Legacy Who Dreams of Becoming Hokage! | NARUTO OFFICIAL SITE (NARUTO & BORUTO)
Urban Dictionary: hungolomghononoloughongous
Ess.compass Associate Login
20 Different Cat Sounds and What They Mean
Beryl forecast to become an 'extremely dangerous' Category 4 hurricane
Del Amo Fashion Center Map
Jordan Poyer Wiki
Drift Hunters - Play Unblocked Game Online
Skycurve Replacement Mat
Phantom Fireworks Of Delaware Watergap Photos
Penn State Service Management
Basil Martusevich
Rvtrader Com Florida
Fridley Tsa Precheck
Kelsey Mcewen Photos
National Insider Threat Awareness Month - 2024 DCSA Conference For Insider Threat Virtual Registration Still Available
D-Day: Learn about the D-Day Invasion
Convenient Care Palmer Ma
How to Get a Better Signal on Your iPhone or Android Smartphone
Wal-Mart 140 Supercenter Products
All Obituaries | Sneath Strilchuk Funeral Services | Funeral Home Roblin Dauphin Ste Rose McCreary MB
Setx Sports
Below Five Store Near Me
Sig Mlok Bayonet Mount
R: Getting Help with R
Ups Authorized Shipping Provider Price Photos
Hillsborough County Florida Recorder Of Deeds
Gt500 Forums
Sinai Sdn 2023
60 Days From August 16
Enjoy Piggie Pie Crossword Clue
Dietary Extras Given Crossword Clue
Strange World Showtimes Near Atlas Cinemas Great Lakes Stadium 16
Joe Bartosik Ms
Prologistix Ein Number
Houston Primary Care Byron Ga
Latest Posts
Article information

Author: Carlyn Walter

Last Updated:

Views: 5671

Rating: 5 / 5 (50 voted)

Reviews: 81% of readers found this page helpful

Author information

Name: Carlyn Walter

Birthday: 1996-01-03

Address: Suite 452 40815 Denyse Extensions, Sengermouth, OR 42374

Phone: +8501809515404

Job: Manufacturing Technician

Hobby: Table tennis, Archery, Vacation, Metal detecting, Yo-yoing, Crocheting, Creative writing

Introduction: My name is Carlyn Walter, I am a lively, glamorous, healthy, clean, powerful, calm, combative person who loves writing and wants to share my knowledge and understanding with you.