How to set up SSH Keys on Ubuntu 16.04

Posted by


SSH, or secure shell, is an encrypted protocol used to administer and communicate with servers. when you are working with an Ubuntu server. You will spend most of your time on terminal connection to your server through SSH.

In this guide You will be tutorial. how to create a key pair and authorization to root user.

  1.  Create the RSA key pair.
    •  First of all. You need to login to your server by root user
    •  By the way SSH or Password.
    • Allowing authorization by password
    • Typing with command
    • Changing to yes and press ^X Exit and press y
    • And then update ssh service

    • Come back on your client machine.
    • Created RSA pair key
    • This tutorial client machine is running Ubuntu client


    • You will get a prompt enter file in which to save the key and enter

    • Another prompt will ask enter passwordphrase  and continue enter
    • Note : If you want your key pair is secured. you can set password to.
    • In this tutorial is empty.
    • Now you change key pair appeared on .ssh folder.
  1. Copy public key to Your server and created authorized
    • Using this command to copy public key from client machine to Server
    • When you typed that command above. it will ask Are you sure you want to continue connecting , Choose
    • And verify your root user password.
    • Now You can access to your server by root user through SSH
    • Remember When you logged in  through SSH successfully. Updated shhd_config
    • PasswordAuthentication no 
    • Continue updating SSH service
    • That’s all steps the root user can access through SSH tunnel.


By the ways make your server more secured. Remember keep private key and public key. in the case those was lost. you can not access to your server.

Wish happy coding.

Leave a Reply

Your email address will not be published. Required fields are marked *