The configuration to enable password authentication in AWS instance:-
-
Log in to the server using ssh client of your choice using
the private key.
ssh -i your-key.pem username@ip_address
-
Set up a password for the user using passwd command along
with the username.
sudo passwd ec2-user # If machine is Amazon Linux sudo passwd ubuntu # If machine is Ubuntu
-
Open the sshd_config file.
sudo vi /etc/ssh/sshd_config
Find the Line containing "PasswordAuthentication" parameter
and change its value from "no" to "yes"
PasswordAuthentication yes
If you want to set up "root" login, find "PermitRootLogin"
parameter and change its value from prohibit-password
to "yes".-
Now, restart the "sshd" service using the following
command.
sudo service sshd restart
-
Now you can log out and log in using the password you set
for the user.
ssh ec2-user@ip_address # ssh ubuntu@15.1.25.40
Note: Although password will be encrypted while communicating with server but it is not recommended to enable the password authentication to connect with EC2 machines using ssh. Easy and common password can be guessed easily using brute force by some malicious user.
Top comments (0)