Answer the question
In order to leave comments, you need to log in
How to establish ssh connection by keys?
I have a server that I access with a password. Next, I want to remove the need for password login. I am using ssh-keygen and it creates id_rsa and id_rsa.pub in ~/.ssh on the client. Next, what should I pass to the server, id_rsa or id_rsa.pub, in order to be able to connect to it?
Used ssh-copy-id to transfer to the server. Without parameters, it passes the private key, specifying the key i, it is possible to pass the public key to authorized_keys, passed it as well. Performed ssh-add on the client and on the server. I checked authorized_keys for the presence of both, everything you need is there. I performed ssh-keyscan on the client, everything is OK, and I still don’t understand what I’m doing wrong?
Please help clarify the situation!! Connection by key does not go, asks for a password. Tell me what to do after I do rm -rf ~/.ssh on the server and client?
Answer the question
In order to leave comments, you need to log in
ssh-keygen #без аргументов, на все вопросы жать enter
ssh-copy-id [email protected] #user - это юзер на сервере server.com, а не локальный
Very simple:
This will copy the key to the server, after that you can disable the password login and log in with the key.
sshpass saves me.
I made a bunch of aliases on different servers and I don't suffer.
Check the SELinux logs. It can cause the described special effect.
Treated by the team:
after handing over the keys.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question