How to Create an SSH Key Pair for Your VPS Server | Cloud - VPS (2024)

  • Linux or MacOS

    • Creating the Key Pair

    • Retrieve the Public Key

    • Configure SSH for Console Login

  • Windows

    • Install OpenSSH Windows

    • Configure OpenSSH

    • Create the Key Pair

    • Configure SSH for connection through the Powershell terminal

  • In Case of “Permission denied (publickey)” Error

When you install a VPS Cloud you will be asked to provide your public SSH key from an SSH key pair you have created. An SSH key pair consists of two keys, a public key and a private key. You will create the SSH key pair on your own computer, then you will provide us with the public key. Your computer and the VPS server will then use these two keys to communicate securely.

Creating this key is a necessary step when creating a new VPS server. This process will be different depending on your operating system.

Linux or MacOS

Creating the Key Pair

First, open a terminal and go to your user’s ssh directory.

cd ~ / .ssh

Next, type the following command.

When you see the following prompt, type enter to accept the default file name.

Enter file in which to save the key (/home/example/.ssh/id_ed25519):

Next, you will be asked for a password. You can type enter to leave it blank or enter a password for added security. You will then validate the password you chose, either by typing enter to confirm a blank password or by typing the password in a second time.

The system will then generate the public key and the private key and save them in the directory specified. Keep the terminal active for the next step.

Retrieve the Public Key

While still in the terminal, use the following command to view your newly created public key. If you gave the key a name other than default replace “id_ed25519” with the name you chose.

cat id_ed25519.pub

Select all of the displayed content, which usually starts with “ssh-” and ends with your username (for example: example @ example).

You can then paste this key in the appropriate field in the creation screen for a Gandi VPS server.

Configure SSH for Console Login

On most Linux systems, the “config” file updates automatically if you use the default filename. You can check to make sure the keys is present using the cat command as shown in the previous section. Make sure you are in the .ssh directory when you use this command.

If the key is present, you can connect to your server directly by going to the “VPS” section in your account interface and clicking on the name of your server. You can then click on the key underneath “Authentication.”

Windows

Install OpenSSH Windows

On Windows 10, the OpenSSH client is available as an optional feature and therefore may not be enabled on your windows.

To check open Windows settings (the gear (⚙) in the menu), then go to Applications and Features and find the link “Optional features”. If “OpenSSH Client” does not appear, click “Add Feature” to do so.

Note

It is not necessary to also install the “OpenSSH Server”.

Configure OpenSSH

Windows does not create the necessary directories by default, so it may be necessary to do this manually from the file explorer.

First, check if the .ssh directory exists by going to your user directory and looking for an .ssh directory. Since this type of file is hidden by default, you should go to “View” in the file explore and check “Hidden Items.”

If the .ssh directory exists you can move to the next step. If it does not exist, create the .ssh directory.

Create the Key Pair

To start, launch a “Windows Powershell” terminal.

Next, go to the .ssh directory.

cd .ssh

Enter the following command:

ssh-keygen -t ed25519

When you see the following prompt, give your key a name. You name should have no spaces or accented characters. For the purposes of this tutorial, we will use “example_25519” as the file name.

Enter file in which to save the key (/home/example/.ssh/id_ed25519):

Next, you will be asked for a password. You can type enter to leave it blank or enter a password for added security. You will then validate the password you chose, either by typing enter to confirm a blank password or by typing the password in a second time.

The system will then generate the public key and the private key and save them in the directory specified.

You should then open the file (”example_22519” in the above example, or whatever name you chose to give the file) using notepad or another text editor.

Next, copy the public key provided in this file and paste it when prompted during the creation of a VPS.

Configure SSH for connection through the Powershell terminal

You will now need to configure SSH to connect to your new VPS server.

The easiest way is to go through the file explorer and create a new text file named “config” in the .ssh directory.

Add the following lines to this file, but with the following changes:

  • Replace “46.xxx.xxx.xx” with the IP address of your VPS. You can find the IP address by going to VPS in your Gandi account, then clicking on the name of the server.

  • Replace “admin” with the default user (debian or ubuntu)

  • Replace “example_22519” with the file name you gave your key.

Host 46.xxx.xxx.xxx User admin IdentityFile ~/.ssh/example_25519

Save the file and exit Notepad.

Once your VPS server is created, you can connect via the command displayed in the administration of your VPS. If you have not entered a passphrase, you will not be prompted for a password when connecting.

In Case of “Permission denied (publickey)” Error

You may encounter this error sometimes when trying to login using SSH. This means that your system cannot find the private key that should be stored on your computer. In this case it is necessary to modify or add the “config” file for your user.

To edit this file you can use Nano or VIM through the terminal, or open the file with an external text editor with a graphical interface. The following steps explain how to edit this file using Nano. In principle, we assume that you are still in the “.ssh” directory where you created the key.

First, type this command.

nano config

Add the following lines to this file, but with the following changes:

  • Replace “46.xxx.xxx.xx” with the IP address of your VPS. You can find the IP address by going to VPS in your Gandi account, then clicking on the name of the server.

  • Replace “id_ed22519” with the file name you gave your key.

Host 46.xxx.xxx.xxx User admin IdentityFile ~/.ssh/id_ed25519

Save the file (CTRL+o in nano) and exit (CTRL+x in nano).

Once your VPS server is created, you can connect via the command displayed in the administration of your VPS. If you have not entered a passphrase, you will not be prompted for a password when connecting.

How to Create an SSH Key Pair for Your VPS Server | Cloud - VPS (2024)
Top Articles
What You Should Know Before Making Large Deposits While Buying a Home — Livian Estates Team
Top DAOs Projects in 2023 | Full List - CFTE
Cold Air Intake - High-flow, Roto-mold Tube - TOYOTA TACOMA V6-4.0
Housing near Juneau, WI - craigslist
Did 9Anime Rebrand
New Day Usa Blonde Spokeswoman 2022
Boat Jumping Female Otezla Commercial Actress
Phillies Espn Schedule
Chicken Coop Havelock Nc
Echo & the Bunnymen - Lips Like Sugar Lyrics
Busted Barren County Ky
065106619
Craiglist Kpr
Paychex Pricing And Fees (2024 Guide)
Lazarillo De Tormes Summary and Study Guide | SuperSummary
The Menu Showtimes Near Regal Edwards Ontario Mountain Village
Traveling Merchants Tack Diablo 4
Quadcitiesdaily
BMW K1600GT (2017-on) Review | Speed, Specs & Prices
Self-Service ATMs: Accessibility, Limits, & Features
Slim Thug’s Wealth and Wellness: A Journey Beyond Music
Bocca Richboro
Foodsmart Jonesboro Ar Weekly Ad
Mdt Bus Tracker 27
Is Henry Dicarlo Leaving Ktla
Abga Gestation Calculator
Turns As A Jetliner Crossword Clue
The Goonies Showtimes Near Marcus Rosemount Cinema
Paradise Point Animal Hospital With Veterinarians On-The-Go
Evil Dead Rise Showtimes Near Regal Sawgrass & Imax
Stouffville Tribune (Stouffville, ON), March 27, 1947, p. 1
Robert A McDougal: XPP Tutorial
Davita Salary
The Hoplite Revolution and the Rise of the Polis
Luciipurrrr_
Tgh Imaging Powered By Tower Wesley Chapel Photos
Kips Sunshine Kwik Lube
Umiami Sorority Rankings
RALEY MEDICAL | Oklahoma Department of Rehabilitation Services
Me Tv Quizzes
Vindy.com Obituaries
Homeloanserv Account Login
Ds Cuts Saugus
Atu Bookstore Ozark
Elven Steel Ore Sun Haven
Enr 2100
Movie Hax
The Bold and the Beautiful
Costner-Maloy Funeral Home Obituaries
Motorcycle For Sale In Deep East Texas By Owner
Online TikTok Voice Generator | Accurate & Realistic
Rise Meadville Reviews
Latest Posts
Article information

Author: Annamae Dooley

Last Updated:

Views: 6288

Rating: 4.4 / 5 (65 voted)

Reviews: 80% of readers found this page helpful

Author information

Name: Annamae Dooley

Birthday: 2001-07-26

Address: 9687 Tambra Meadow, Bradleyhaven, TN 53219

Phone: +9316045904039

Job: Future Coordinator

Hobby: Archery, Couponing, Poi, Kite flying, Knitting, Rappelling, Baseball

Introduction: My name is Annamae Dooley, I am a witty, quaint, lovely, clever, rich, sparkling, powerful person who loves writing and wants to share my knowledge and understanding with you.