Tutorial: Enable SSH access to your instance using a username and password

posted Sep 28, 2015, 10:59 PM by SRGICS UPLB   [ updated Sep 29, 2015, 5:51 PM ]
As described in the User Guide, you can connect to your instance using a key pair as shown below.
$ssh -oUserKnownHostsFile=/dev/null -i jachermocilla-guest-p2c.pem ubuntu@

However, using a username and password to login maybe more convenient, especially if you are sharing access to others.  This tutorial describes how to configure SSH for this on an Ubuntu instance.

First login using the key pair as described above then become root.
$sudo -s

Second edit /etc/ssh/sshd_config. Set PasswordAuthentication to YES.
#nano /etc/ssh/sshd_config

Third, restart the SSH server.
#service ssh restart

Fourth, create a new user. You need to supply the password and other information for the user.
#adduser newusername

Fifth, add newusername ALL=(ALL:ALL) ALL to /etc/sudoers. This will give the new user sudo access.

#nano /etc/sudoers

Sixth, logout of the instance.


That's it! You can now connect using username and password.

$ssh -oUserKnownHostsFile=/dev/null newuser@