G
G
gera72022-01-15 19:18:27
linux
gera7, 2022-01-15 19:18:27

How to generate .pem key on Linux for remote connection?

The only way I know of to connect remotely is to generate a public+private key pair on the host and send the public key with the ssh-copy-id command to the remote server, asking for a password the first time.

But, for example, when creating an instance in AWS, a .pem key is immediately issued, which is very convenient for further connection both through MobaXterm and through the terminal with the command ssh -i "key.pem" [email protected]

What actions need to be performed to generate .pem key and its subsequent use? Create a public + private key on a remote machine and somehow convert the private key to .pem?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Saboteur, 2022-01-16
@gera7

pem is not really a format, a container inside which there can be a certificate, or a chain of a certificate, a private key and a root certificate.
Therefore, look at what is generated in your pem.
And so - ssh-keygen can generate in PEM format:
ssh-keygen -t rsa -m PEM
Or convert an existing one:
ssh-keygen -f id_rsa -e -m pem
And so, the modern version of ssh-keygen already generates a key in a valid pem format.

A
AVKor, 2022-01-15
@AVKor

Here .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question