S
S
Sergey2015-02-13 13:12:07
linux
Sergey, 2015-02-13 13:12:07

How to login with ssh key to the server?

Got a job on the server, no password from ssh.
There is access to whm and cpanel.
I created the rsa 2048 key in whm and entered the
password. The server has the key. I authorized it through the panel, everything is ok. Named it as standard id_rsa. Disabled password authentication.
I do ssh-keygen -t rsa in my ubuntu console and
enter the same password. I also name the key id_rsa
Then I do
ssh-copy-id -i ~/.ssh/id_rsa.pub -p port [email protected]
Writes me
Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
It's just that I can't log in via ssh -p port [email protected] either.
Writes the same. How to enter by key?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander, 2015-02-13
@butteff

Er... I don't even know where to start...
Why do the keys have to match? They are randomly generated. The password is only needed to decrypt the key.
When you generate a key, a pair is generated - public and private. You must add the public one to the server in ~/.ssh/authorized_keys
If you generated it with the standard name id_rsa, then the public one will be called id_rsa.pub - the contents of this file must be added to ~/.ssh/authorized_keys
And the id_rsa file itself must be in ~ /.ssh of the machine you are logging in from.

A
AVKor, 2015-02-15
@AVKor

How to enter by key?

To enter by key, the public key must already be on the server. To copy it there, you need the possibility of authorization in another way. See server response:
Permission denied (publickey,gssapi-keyex,gssapi-with-mic).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question