Most Cloud Providers do not allow you to log in directly using Password. It will ask you to use public/private key to log in. This post is using AWS EC2 instance as an example to enable password authentication for your SSH session. This is not recommended and only for your testing purpose. It dramatically lows down your security configuration.
Here are all steps:
1. From an SSH client, log in to your EC2 instance.
Use one of the following user names:
- For Amazon Linux, the user name is ec2-user.
- For RHEL 5, the user name is either root or ec2-user.
- For Ubuntu, the user name is ubuntu.
- For SUSE Linux, the user name is either root or ec2-user.
If ec2-user or root doesn’t work, check with your AMI provider.
2. Set a password for user. The example below uses ec2-user as the user:
$ sudo passwd ec2-user
Changing password for user ec2-user.
Retype new password:
For example, a successful response looks like this:
passwd: all authentication tokens updated successfully.
3. Update the PasswordAuthentication parameter in the /etc/ssh/sshd_config file:
4. Restart the SSH service.
For Amazon Linux, RHEL 5, and SUSE Linux, use this command:
sudo service sshd restart
For Ubuntu, use this command:
5. Exit the SSH client, and then log in to test the password authentication.
Notes: It will enable your SSH Password Authentication method, original SSH key authentication method is still enabled.