WARNING: UNPROTECTED PRIVATE KEY FILE! when trying to SSH into Amazon EC2 Instance

前端 未结 11 2223
慢半拍i
慢半拍i 2020-12-12 11:06

I\'m working to set up Panda on an Amazon EC2 instance. I set up my account and tools last night and had no problem using SSH to interact with my own personal instance, but

11条回答
  •  生来不讨喜
    2020-12-12 11:55

    Keep your private key, public key, known_hosts in same directory and try login as below:

    ssh -I(small i) "hi.pem" ec2-user@ec2-**-***-**-***.us-west-2.compute.amazonaws.com
    
    • Same directory in the sense, cd /Users/prince/Desktop. Now type ls command and you should see **.pem **.ppk known_hosts

    Note: You have to try to login from the same directory or you'll get a permission denied error as it can't find the .pem file from your present directory.


    If you want to be able to SSH from any directory, you can add the following to you ~/.ssh/config file...

    Host your.server
    HostName ec2-user@ec2-**-***-**-***.us-west-2.compute.amazonaws.com
    User ec2-user
    IdentityFile ~/.ec2/id_rsa-gsg-keypair
    IdentitiesOnly yes
    

    Now you can SSH to your server regardless of where the directory is by simply typing ssh your.server (or whatever name you place after "Host").

提交回复
热议问题