AWS Certified Solutions Architect - Associate (SAA-C02)

Sign Up Free or Log In to participate!

I can’t ssh into my ec2 server, using the private key. it tells me permission denied. no such file or directory

Warning: Identity file /path/to/key/pem not accessible: No such file or directory.

Permission denied (publickey,gssapi-keyex,gssapi-with-mic).

2 Answers

That error is too obvious: you were specifying a non-existing private key.

When you finish creating an instance, if you choose to create a new keypair, AWS Console will ask you to download the private key and store it somewhere on your computer. The download can only be done once, and AWS expects you to keep that private key safely. You can use the same private key to access any new EC2 instance if the new instance is created with the same keypair as the old one. If you loose your private key, you won’t be able to access the instance created with corresponding keypair, and you have to create a new one (unless you’ve configured OpenSSH in your instance to allow logging in with password).

It’s worth to notice that, /path/to/key/pem is just a dummy path to represent the location of private key. In reality, you have to replace it with the actual absolute/relative path of the private key that is actually stored on your computer.

B.N 50

hey man. appreciate you for taking your time. I have found the path where my key pair is stored.

B.N 50

C:Users18064DownloadsMyBNkp.pem . This is where my key pair is stored. But i still cant ssh into my ec2 instance. Its still giving me the permissions denied. what am i doing wrong?

B.N 50

This is frustrating

B.N 50

im Very new to this command line stuff. That’s why it’s confusing

Evan Walsh

B.N, Suggest maybe you start with some command line specific stuff if you’re just getting started.

Evan Walsh

A good lab exactly related to what you are doing: https://learn.acloud.guru/handson/ab71a320-b020-4bad-87c6-4057e3b91752

Evan Walsh

Also, Look at learning paths > aws architect. In Apprentice level, there is some great CLI Basics lessons that might help, in addition to SSH Basics. Spend a few hours diving into these courses first, and you will be navigating the CLI in no time!

Tuan LE

So you’re on a Windows machine. Generally there are two main ways to connect to a Linux machine from Windows with SSH key: one is using an GUI-based SSH client like Putty (simply select the PEM file within Putty); the other way is using a Linux emulator like Cygwin, from within a Cygwin session, specify the absolute path to C:Users18064DownloadsMyBNkp.pem from within Cygwin context (usually it would become /cygdrive/c/Users/18064/Downloads/MyBNkp.pem). You will have to deal with two different directory path concepts (Linux vs. Windows) at the same time, which will be difficult if you have no experience with CLI. I would advise you to use directly Putty and simply load the PEM file to Putty.

The discussion is about I can’t ssh into my ec2 server, using the private key. it tells me permission denied. no such file or directory Prior to utilizing the sequential control center, award admittance to it at the record level. Then, at that point, make AWS Identity and Access Management (IAM) approaches that award admittance to IAM clients. Additionally, all occurrences utilizing the control center should have no less than one client with a secret word. In the event that the example can’t be reached and you have not arranged Serial Console access, adhere to the directions in techniques 2, 3, or 4. For data on designing see https://mobilunity.com/blog/offshore-software-development-services/

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?