I don't know if I'm overthinking this too much but I can't seem to understand how to use a ssh public key to create an ssh connection trough my mac.
I'll list my steps bellow:
-
First created the SSH keys in my server in cpanel -> SSH keys and created a key pair with name
id_rsatest
-
Then I downloaded to my mac both public and private key files, so now in my downloads folder I have the files:
id_rsatest
andid_rsatest.pub
-
Then I moved the
id_rsatest.pub
file toUsers/myuser/.ssh/
and opened Terminal.app -> Shell -> New Remote Connection and entered the information below:and receive this error:
ssh: connect to host example.com port 22: Operation timed out [Process completed]
What am I doing wrong? Is this even the way on how to create a SSH access with SSH keys?
Best Answer
You got it the wrong way round :-)
id_rsa.pub
andid_rsa
into~/.ssh
and runchmod 600 id_rsa
append the generated public key (
id_rsa.pub
) to.ssh/authorized_keys
on the remote machine (your server in this case). If you are allowed to login in viassh
using a password, useotherwise transfer the file by whatever means you have to upload files.
ssh remoteuser@remotemachine
in your shell to connectPS: The private key should never need to leave the machine it's generated on