Creating An SSH Connection To Remote Server

Hello devs in this tutorial i will discuss about how to ssh into a server using terminal. You know that SSH is an amazing way to make secure connections to servers.
It stands for Secure Shell and it's a network protocol between two computers

SSH gives us a secure connection between two network protocol. In today's article, I am going to show you how to set up an SSH connection to a server..

The basic command will look like this:

// or
ssh user@


We could do it with a password we set on the server, however in this case i don't want to do that. 

Generating the SSH key

Before we can do anything we need an SSH key to connect to the server. So we have to generate it. So let's open up the terminal and run the following command to generate  a new SSH key.

ssh-keygen -t ed25519 -C ""


This will prompt the following options. See the below image and try it



Ok, Now we should have the public and private keys.

Setting the Authorized keys

Our server should have a ~/.ssh/ directory, if not you have to make it. Inside we should have or add the file: authorized_keys.

nano ~/.ssh/authorized_keys


No do the below step 

pbcopy < ~/.ssh/


Where server_1 is the name you gave your key. It will copy a string like that to your keyboard.

ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIH4TBYa16+8t9LJmqCuMjq+4PSxca81L8sN8OSgT5YW9


Connecting to the server with the SSH key

We have to add our new key with the following command

ssh-add -K ~/.ssh/server_1


Now time to test out our SSH key.

ssh user@


Change the user and IP according to your server. Hope it can help you.


#ssh #server