When you first log into the EC2 instances on AWS , you can only ssh using key pairs.
so the command to log in looks something like this:
ssh -i mykey.pem ec2-user@32.33.34.35
But what if you want to enable password ssh?
We can follow these steps :
- Create an EC2 instance. If you have one already , skip this step.
- Become the super user and open the sshd config file
sudo su
vim /etc/ssh/sshd_config
- Change the PasswordAuthentication no config to
PasswordAuthentication yes
- Restart the sshd daemon
service sshd restart
- set the password for the ec2 user /or create new user
passwd ec2-user
adduser bob
passwd bob
- Exit out and try loggin into the EC2 using the password
ssh ec2-user@32.33.34.35
you should now be logged in without using the .pem file