SSH access using .pub key

You got it the wrong way round :-)

  • create a key pair on the Mac you are using
  • put both id_rsa.pub and id_rsa into ~/.ssh and run chmod 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 via ssh using a password, use

    ssh remoteuser@remotemachine "mkdir ~/.ssh; cat >> ~/.ssh/authorized_keys" < ~/.ssh/id_rsa.pub
    

    otherwise transfer the file by whatever means you have to upload files.

  • run ssh remoteuser@remotemachine in your shell to connect

PS: The private key should never need to leave the machine it's generated on