Trying to SSH into an Amazon Ec2 instance - permission error

后端 未结 29 3491
一生所求
一生所求 2020-11-27 08:51

This is probably a stupidly simple question to some :)

I\'ve created a new linux instance on Amazon EC2, and as part of that downloaded the .pem file to allow me to

29条回答
  •  我在风中等你
    2020-11-27 09:31

    Following are the simple steps for Linux user to connect with the server using .pem file:

    Step1: To to the location of pem file and copy it to home .ssh location.

    cp example.pem ~/.ssh/example.pem
    

    Step2: Change the permission

    chmod 400 ~/.ssh/example.pem
    

    Step3: Run the following command

    ssh -i ~/.ssh/example.pem ec2-user@host.com
    

    As this command is too long so you sould create the alias of this using following commands:

     vim ~/.bashrc
    

    Write the same command in the following manner at the last.

    alias sshConnect='ssh -i ~/.ssh/example.pem ec2-user@host.com'
    

    Now restart your system and use sshConnect to connect with your server.

提交回复
热议问题