Let's define
<service_name>
- i.e. Vultr: service_name = vultr, GitHub: service_name = github
<location>
is short name + index- i.e. Frankfurt DC = fr1, Stockholm DC = st1
<vps_name>
=<service_name>-<location>
- i.e. Vultr VPS in Frankfurt DC = vultr-fr1
Generate ssh key for vps server
ssh-keygen -t rsa -b 4096 -C "<client_name i.e. mbp13 or username>" -f ~/.ssh/<service_name>_rsa
Add to local ~/.ssh/config
Host *
UseKeychain yes
AddKeysToAgent yes
Host <vps_name>-root
HostName <hostname>
Port 22
User root
IdentityFile ~/.ssh/<service_name>_rsa
ServerAliveInterval 120
IdentitiesOnly yes
Host <vps_name>-vps
HostName <hostname>
Port 22
User vps
IdentityFile ~/.ssh/<service_name>_rsa
ServerAliveInterval 120
IdentitiesOnly yes
Fix server ssh config
vim /etc/ssh/sshd_config
Find all includes and change it to the following values:
ChallengeResponseAuthentication no
PasswordAuthentication no
UsePAM no
PermitRootLogin prohibit-password
And reload ssh service:
systemctl reload ssh
Check from local host in the separate terminal that you can connect to ssh:
ssh <vps_name>-root