Tag Archives: Linux

How to SSH from Windows to Linux using PEM file

Connecting your Linux machine from the windows system is straightforward. You can open command prompt and ssh to the Linux machine using hostname or IP Address. To make it password less, we can generate the rsa key on the windows and copy that on the authorized_keys file on the linux server. There is one more way to achieve this which is using the .pem file. Like we use connecting to an EC2 instance.

This Article will guide you a simple and short steps to ssh from windows to Linux using PEM file.

  1. Login to the Destination/Remote server (Linux server in this case).
  2. Switch to the desired user.
  3. Generate ssh keys using command:
    ssh-keygen -t rsa

4. You will see two keys in .ssh directory, one is id_rsa (private key) and id_rsa.pub (public key).

5. Copy the content of id_rsa.pub into authorized_keys in .ssh directory
cat id_rsa.pub >> ~/.ssh/authorized_keys #644 permission for authorized_keys

6. Now, copy the content of the id_rsa file and create a PEM file on the windows machine.

7. Open command prompt on the windows machine and try to ssh using command:

ssh -i mykey.pem ssh-user@Linux-Server

And it should let you login without any password prompt.