
Resolve SSH require password when using key from local
This error happens when you try to SSH into an EC2 instance with a key, but the server require password to login. It’s caused by PasswordAuthentication yes in the SSH config. This guide shows how to fix it by enabling key-based access and disabling password authentication.
Published Apr 15, 2025
Connect to EC2 instance by using Instance Connect to bypass for password authentication.

- Switch to the root user.
- Open the SSH configuration file.
- Find the line
PasswordAuthentication yes
and change toPasswordAuthentication no
- Save the file and restart the SSH service.
- From your local machine, run following command.
- Copy public key, and note that key so that we will pass that key to remote EC2 instance.
- On the EC2 instance, paste the public key into the
~/.ssh/authorized_keys
file for the desired user.
Now, SSH into your EC2 instance using your private key.
🚀 BE HAPPY ON CLOUD 🚀