I have two boards that run linux os: the client runs raspberry os and the server runs ubuntu18.04. On the client, I generate an SSH key-pair using this command:
ssh-keygen
It prompts me to enter a file in which to save the key, I wrote my_key. After that, I pressed enter to fill empty the passphrase. It generates 2 files : /home/asd/.ssh/my_key and /home/asd/.ssh/my_key.pub
Using this command:
ssh-copy-id -i /home/asd/.ssh/my_key.pub client_username@hostname
I copied the public key on the server. I checked it, all the things were fine until now. When I tried to connect to the server, It prompts me to write the password. Why?
If I generate an SSH key-pair, and I fill the name file where to store to be default ( /home/asd/.ssh/id_rsa), I could connect to server without to ask me the password. Did I do something wrong when I chose my own name of the file where it is stored the key?
EDIT: To connect to the server, I used the next command:
ssh client_username@ip_server
-i
on thessh
command line (or via a.ssh/config
file). See for example Specifying an IdentityFile with SSH.ssh/authorized_keys
file?