How to connect to an EC2 instance using SSH when the .pem file permission is denied?
Loading
How to connect to an EC2 instance using SSH when the .pem file permission is denied?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Deepak TewatiaPosted Dec 14, 2025, 6:00 AM
When you try to SSH into an EC2 instance, the .pem key must be readable only by your local machine’s user account .
If you’re on Windows , sometimes the terminal (CMD or PowerShell) doesn’t have the correct permission to read your
.pemfile.That’s why SSH throws “Permission denied”.
The fix is simple:
Right-click the .pem file ? Properties
Go to Security tab
Remove all users except your own
Make sure your user has Read permission
Apply changes
This makes the key “private” so SSH can use it.
After that, your SSH command will work.