Assuming that you have a Server with SSH, and a client from where you want to connect to Server, you need to create the private and public keys in the client machine, and copy the public key in the server.
Before this, you need to check where your SSH Server is looking for client authorized keys. You need to check your SSH Server config file /etc/ssh/sshd_config, and locate the next line:
This tells that the server will search in the file called
authorized_keys of each user home directory, into
.ssh folder, for the public keys authorized for the login of this user.
Now, in your client, as you said that you have already using the SSH key generated in the client, you need to copy the content of your public key into the
authorized_keys file of the user which you want to login in the server.
For simplifying this, the steps are:
- Search for the
AuthorizedKeysFile directive in
/etc/ssh/sshd_config in the server.
- Create the private and public keys in the client (you have already did it).
- Copy the content of your client public key to the
authorized_keys file of the user you want to login in the server. If you want to login with the user
username, you need to copy the public key to
/home/username/.ssh/authorized_keys file (create it if doesn't exist).
Hope this helps.