Part 2: Connect to shared server (VPS) using SSH
If you don’t already have a key - generate a key pair locally:
$ ssh-keygen
I chose the default. Some suggests not to type a password if you are the only person to have root access to the machine.
Once the key was generated, I copied key to remote shared server:
$ ssh-copy-id root@IP_address_of_VPS
The shell prompted me to type the password for the username of the VPS.
Still on the local machine, I ran:
$ ssh root@IP_address_of_VPS
The shell prompted me to verify the fingerprint of the SSH key of the server.
The VPS provider I use sends the fingerprint via email when setting up the server.
If you need to find out the SSH’s key fingerprint: https//yctct.com/ssh-show-fingerprint
If the key matches, type yes
.
You should see something like:
root@vps_username:~#
Security
Once I am sure SSH is enabled, I disable log in via password and else by un-commenting the following line and setting them up to no
in the file /etc/ssh/sshd_config
.
PasswordAuthetification no
UsePam no
Make sure you use sudo vi
to edit /etc/ssh/sshd_config
.
When you are done, reload the SSH daemon:
systemctl reload sshd
Source: https://landchad.net/sshkeys/
personal computing command-line interface (cli) gnu linux trisquel shell literacy office applications wiki