Create your own .pem for ssh login using certificate

Some of my colleagues asking me this, how can i login to my server using certificate like i login to aws (amazon web services).

1. Setup your server ssh-keygen -t rsa -b 2048 cat ~/.ssh/ >> ~/.ssh/authorized_keys

2. Copy your secrets to your a file let’s give it a name ‘awan.access.pem’, you can give it any name you want scp . cp id_rsa awan.access.pem chmod 0600 awan.access.pem

or just cat the id_rsa file, copy the content to a file and rename the file

3. Let’s access our box using .pem certificate file from any box, please don’t share the key to unauthorized personel ssh -i awan.access.pem

awan : change is to your username : this is also an example, change this to your server ip, linux box, or your domain name

after step number 2 your can create image or snapshot from the virtual machine or container so next time you login you don’t have to regenerate the key anymore.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s