By Team Clofus Innovations | Mon Jan 17 2022
 
          We all know that EC2 comes default with ssh key pair authentication instead of traditional password login, but there at times we might need to use password based authentication for some scenarios like handing over access to someone who needs to login right away without them moving the private key file

So inorder to achieve password based authentication, just follow the easy steps
1) SSH Login using key pair that you generated or used an existing when you first launched the EC2 instance
2) Create an user, in the below case ‘developer’ is the user & Set password for the newly created user
sudo useradd -s /bin/bash -m -d /home/developer  -g root developer
sudo passwd developer
3) Do visudo to be able to add the developer user to give sudo access.
          sudo visudo
          developer  ALL=(ALL:ALL) ALL
          
4) Enable password authentication in sshd_config file
sudo vi /etc/ssh/sshd_config
            PasswordAuthentication yes
          
5) Restart the ssh server as below and now you can just login
          using password now
          
          sudo /etc/init.d/sshd restart 
          
Hope it helped fixing the password based login issue and please feel free to ask us any queries and leave us your comments