Skip to Content

Add a server using ssh key pair in ezeelogin

How to add a server using ssh key pair in Ezeelogin?


Overview: This article guides gateway users through the process of adding a remote server to a jump server (gateway server) using an SSH key pair. It also explains how to add a gateway server using Ezeelogin's global key, enabling users to add a remote server without needing to enter a password.



1. How to add a Linux server using private keys?

Step 1(A): Create a ssh key pair on the server using the below command:

root@remote_server:~# ssh-keygen
 
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
/root/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:eUKBEdUlDVzQgCKT3QHBVwHHCH0IjWa8cDdNkRBrvZM [email protected]
The key’s randomart image is:
---[RSA 2048]----
|     =B#B/@%o    |
|    = @ @=B.o    |
|     B = o.      |
|      .o . o     |
|        S E      |
|         o .     |
|                 |
|                 |
|                 |
----[SHA256]-----

 Now, the public key has been saved in the file /root/.ssh/id_rsa.pub and private key in /root/.ssh/id_rsa.

You can skip step 1(A) if you already have your own SSH key pair.

Step 1(B): Click on the servers tab and then click on add server on the right.

Step 1(C): Fill in the details of the server to be added. Copy the private from /root/.ssh/id_rsa and paste the entire private key into the SSH Private Key field without providing the password. Also, provide the exact SSH Key passphrase used during the key generation (leave blank if no passphrase was used).

 

While adding private key make sure to add the entire key including "BEGIN RSA PRIVATE KEY" and "END RSA PRIVATE KEY". Even a missing "-" could result in corrupted key.

Step 1(D): Copy the public key from /root/.ssh/id_rsa.pub and paste it inside the authorized_keys file of the user in the remote server.
 

root@remote_server:~# vi /root/.ssh/authorized_keys

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCzCOoNRS9t6Eg86XMmnH9V8irlmDQn+G1x+d41aIEwrgllgrfCHe1QwJeTUhME7SnarbjmVLQfYuSVLpb0BtFoqdHQXY/Kp6yuyuJWsRntiPzH5YuVhN0zaITdmnmALTLip9A9hi+pbMy51tDAwJCJPJjvf51VW313ddG9lxmWbzHTHbIQHwV0TPFP8lj2BDDCSL5nw+2QiQ+R36GI8YVpn0aB1RqRMCPyE+lWJOsvfRs+SvUawkbUgTCg9nhEBPb/Xj1INtZnU6A0J2T6mk5tsMb70pEvDWbd6QPpwhOo/3UT5vk5Qt4Q+RBKyheS6jP7lhlpfG9cwtqYRmZ3n74f8qnmwiRCVppiRmSW6YepM0/KoL1byk7RVbaiYWxQZJwdiH/Xfda/nGji6cb0mrsBxKV7QXpF/kstlMQ7zT5HoEGXRYRN4rll+ekCFnpFkCjZ75ss+hOwrmd1iW9luiGdHiV3aQaGTMxWqD48OXXZuoAeC6NVE5LEiqRbOn4W3KPDky4b490UedMhpRdhVXm+Ow3GQJgCPOGqbPP2Huftxn5ZIm3XGfW85J4SsChQ+b3jrxeZF5h/e+nrYWqoTbPxH7DCWVRoI1lu174eBkdUR5oJc4C5v5qTbyzqNE6WK3jsgcazfK32eabCyKfH2AeKAGZM1o4Zn3MozmGFKfNrw

Step 1(E): Login to Ezeelogin backend(ezsh) or click on the 'Open Web SSH Console' icon to SSH via the browser and access the remote servers as the gateway user.
 

ssh -p <port_number> <gateway_user>@<gateway_ip> 

Example: ssh [email protected]

Step 1(F): Click on the 'Open Web SSH Console' icon to SSH via the browser.


2. How to add a Linux server with the public key (global key) of Ezeelogin?
 

Step 2(A): Copy the public key (global key) of Ezeelogin from the GUI or from backend which is under /usr/local/etc/ezlogin/id_key.pub.

Step 2(b)  Paste the global key inside the authorized_keys of the user in the remote server.

root@remote_server:~# nano /root/.ssh/authorized_keys

Step 2(C): Login to Ezeelogin backend(ezsh) or click on the 'Open Web SSH Console' icon to SSH via the browser and access the remote servers as the gateway user.
 

ssh -p <port_number> <gateway_user>@<gateway_ip> 

Example: ssh [email protected]