Connect to VPS via SSH Key in macOS is simple, you can use Terminal or iTerm to do it. If you prefer GUI, you can choose alternative Termius, which will introduce in another article.

 

At first, we need to download or generate key, the process is simple and has been explained in other article.

 

1. Access via downloaded key

Extract the zip file "ssh_rsa_keys.zip", there are two folders "public_key" and "private_key". In the "private_key", there are two format Private Key, we need to use the "id_rsa.pem" for macOS.

To use the key, we need to modify the file permission using the following command.

chmod 600 id_rsa.pem

Then we can connect with the Private Key using this command.

ssh -i id_rsa.pem root@DMIT_VPS_IP

Please note that, you will be asked for confirmation at the first time to connect the IP.

After reinstall the system's "ECDSA key fingerprint" will be changed, then you will be unable to connect.

To solve this, you need to remove the previous Host Key in the "~/.ssh/known_hosts" or you can just the following command.

ssh-keygen -R YOUR_VPS_IP

 

2. Access via self-generated key

Not like the downloaded key, the self-generated key's permission is pre-changed and can be use to connect directly. The command to connect is the same as the above one.

  • 1 Users Found This Useful
Was this answer helpful?
Related Articles
How to generate SSH Key via XShell
1. Click "Tools" - "New User Key Wizard" 2. Left everything unchanged and click "Next" 3....
How to generate SSH Key via PuTTY
1. Start "PuTTYgen",left everything unchanged then click "Generate". 2. It cost a few minutes...
How to generate SSH Key via macOS
1. You can choose generate Key if you don't want to use the "DMIT Auto Generate Function"....
How to download SSH Key from DMIT website
1. Browse DMIT website, access clientarea and click the services in the "Your Active...
How to connect DMIT VPS via SSH Key using XShell
1. Start XShell, click "Tools" - "User Key Manager" to import or manage key. 2. Click "Import"...