SSH Keys
Getting Started

SSH Keys

  • 2023-02-08 23:36:07

Unable to access server with password

By default, each VPS you will log in with the root username and root password that the provider sent you when renting the VPS, but using a password always has 2 big risks:

  • You will lose it completely if you reveal your password.
  • Attackers can use Brute Force Attack to detect passwords.

Therefore, to make authentication of connections from outside to the VPS more secure, password authentication over SSH is disabled by default on all servers connecting to FlashVPS and is not re-enabled.

What is SSH Key?

SSH Key is an authentication method of logging in with the server through SSH access by comparing a pair of keys, including a private key (private key) and a public key (public key). Private key and Public key are closely related to each other for the purpose of identifying each other.

SSH Keys are often used as an ALTERNATIVE OF PASSWORD by verifying access. Simply put, this login is a question and answer format, where one party presents a question and the other has to provide a valid answer in order to be authenticated.

How to generate SSH Key

FlashVPS supports automatic SSH Key generation

  1. First you access the SSH Keys management page https://flashvps.dev/user/ssh-keys
  2. Hit the generate new SSH key button
  3. A popup appears, click "Generate me an SSH key"SSH Keys 0
  4. You proceed to download 2 files OpenSSH Key and PuTTY Key to your computer.
  5. Press the "Generate New SSH Key" button to finish.

Generate SSH Key with PuTTY-Gen software on Windows

  1. Install PuTTY software at https://www.putty.org/
  2. Click the Generate button and drag the mouse around the screen until it finishes generating.SSH Keys 1
  3. After completing the SSH Key creation, save the Private Key by clicking the "Save Private Key" button and keep it safe. You can set a password for the Private Key to increase security by entering "Key passphare" and "Confirm passphare" before pressing the "Save Private Key" button. SSH Keys 2Public Key is ssh-rsa AAAA ... Use it to enter FlashVPS!

Generate SSH Key using puttygen on (Ubuntu/MacOS)

Install puttygen

For Mac :brew install putty

For Linux :sudo apt install putty-tools

Generate SSH Key (version 2)

puttygen -t rsa -b 2048 -o /home/flashvps/.ssh/id_putty_flashvps --ppk-param version=2 

Generate SSH Key (version 3)

puttygen -t rsa -b 2048 -o /home/flashvps/.ssh/id_putty_flashvps 

After running the above command, the Private Key file will be saved at the path you entered, To use the key you need a Public Key. Create the Public Key as follows:

puttygen -L /home/flashvps/.ssh/id_putty_flashvps

After running the above command, you will see the returned content in the form of ssh-rsa AAAA...you copy this code and add it to your server.

In case you need to save Public Keysomewhere you run the following command:

puttygen -L /home/flashvps/.ssh/id_putty_flashvps > /path/to/save/filename.pub

The file will be saved at/path/to/save/filename.pub

Note: change /home/flashvps/.ssh/id_putty_flashvpsto the path to save your file.

Generate SSH Key using ssh-keygen (Windows/Linux/MacOS)

For Windows

Enable OpenSSH Client on Windows 10 by:

  1. Open the Settings panel , click Apps
  2. Under the Apps and Features heading , click Optional Features. SSH Keys 3
  3. Scroll down the list to see if OpenSSH Client is listed
    • If not, click the + next to Add a feature.
    • Swipe down the list to find and select OpenSSH Client. SSH Keys 4
    • Finally, click Install.

After activating the OpenSSH Client, open it command linewith admin rights and run the following command:

ssh-keygen -t rsa -m PKCS8 -b 2048 -f "C:\Users\your_username\.ssh"

Replace C:\Users\your_username\.sshwith the path where your ssh key is stored.

For Linux/Mac

ssh-keygen -t rsa -m PKCS8 -b 2048 -f $HOME/.ssh/id_rsa_flashvps

After running the above command at the path $HOME/.ssh/there will be 2 files named id_rsa_flashvps(Private Key) and id_rsa_flashvps.pub(Public Key) you copy the Public Key content and add it to your server.

Add SSH Key to the server

Before connecting the server with FlashVPS, you should enter the SSH Key in the SSH Keys page so that every time you connect a new server, the entered SSH Keys will be automatically added to the new server without having to do anything. .

To manually add SSH Key to the server, go to panel > Select Server > SSH Key and add the SSH Key like the steps above.

Author FlashVPS Admin
FlashVPS Admin
Joined in 3 years ago