how to configure SSH key-based Authentication in Linux VPS or Dedicated Server

This article will guide how to configure SSH key-based Authentication in Linux VPS or Dedicated Server

In SSH Key-Based Authentication, all we do is generate public authentication key and copy the key over Linux VPS or dedicated server to connect without typing the password.

Below are the steps on how to execute SSH Key-Based Authentication in Linux VPS or dedicated server.

  1. Open the terminal of your local Linux machine.
  2. The first step is to create key-pair on the local machine.
    Enter the command ssh-keygen.
    Enter file in which to save the key (/home/andrew/.ssh/id_rsa): (Press “Enter”)

    01-create-key-pair-on-local-machine



  3. If the key was already present then you may see:
    Overwrite (y/n)? (press “y” and then enter)

    02-overwrite-the-key

  4. Then you should see the following output:
    Enter passphrase (empty for no passphrase): (press “Enter”)
    Enter same passphrase again: (press “Enter”)

    03-enter-passphrase



  5. To copy the key of your Linux server, enter the following syntax.
    ssh-copy-id (username)@(IP of your Linux VPS or dedicated server) -p (port no.).

    04-copy-the-key-of-your-server

  6. Then it will prompt for a password, Enter the VPS/Dedicated server’s password.
    It will copy the contents of your ~/.ssh/id_rsa.pub key into host server’s authorised_keys.

    05-enter-the-password

  7. The process is completed successfully, now you can SSH from the local machine to your VPS/dedicated server without typing the password.

    06-completed-successfully




  • 0 Users Found This Useful

Was this answer helpful?

Related Articles

How to Deploy Laravel Application with Nginx on Ubuntu?

Laravel is a PHP Framework and Nginx is a Web-Browser which can be installed on Ubuntu. Nginx is...

How to sync time using NTP in Ubuntu server?

Linux server users might have noticed that after adjusting the system clock to the correct time,...

How to check Inode usage from cPanel and Command line?

Inode is a data structure that stores the information about all files created on your hosting...

How Do I Check Bandwidth Utilization of VPS?

Windows VPS To check/monitor usage of each Windows VPS, we have installed bandwidth meter tool...

Virtual Machine with CentOS 5 32-Bit OS Does not Address Physical Memory More Than 3 GB

Recently we came across very strange issue wherein Linux virtual machine with Centos 5.X 32 Bit...