Resolve Unprotected Key Error When Connecting to EC2 Instance on Mac - VicPhanDevOps/mac GitHub Wiki

• The following resolution is for when you receive the WARNING: UNPROTECTED PRIVATE KEY FILE! error when trying to connect via SSH to an EC2 instance.
image

• Type chmod 400 *pem and press the return key to enabled permissions for the .pem files.
image

• Type ssh -i “< .pem file >” < user >@< EC2 instance > and press the return key to connect to the instance via SSH.
image

• Type yes and press return key.
image

• You will connect to your EC2 instance with the error this time around where you can run commands.
image

• Type exit and press the return key when you are ready to disconnect from the instance and return to the Mac’s shell.
image

⚠️ **GitHub.com Fallback** ⚠️