If you have worked with Linux AWS EC2 instances you know that in order to connect to them via SSH, by default you use the syntax:
ssh -i < Key.pem > user@hostname
where < Key.pem > is a SSH key pair you generated previously to connect to your instances. But what if you want AWS Connect to Linux instance with user and password?
Getting started with AWS Connect to Linux instance with user and password
Well, just follow these steps:
Connect to the instance as usual:
ssh -i "AWSKey.pem" ubuntu@ec2-18-228-12-179.sa-east-1.compute.amazonaws.com
Edit /etc/ssh/sshd_config and change PasswordAuthentication to ‘yes’
PasswordAuthentication yes
Create a new User and assign a password:
sudo adduser john
After the user is added we can log out of this session and try to connect with the new user and password:
$ssh john@ec2-18-228-12-179.sa-east-1.compute.amazonaws.com
john@ec2-18-228-12-179.sa-east-1.compute.amazonaws.com's password:
Welcome to Ubuntu 18.04.1 LTS (GNU/Linux 4.15.0-1034-aws x86_64)
john@knode1:~$
Success!