How to log into AWS instance using password authentication

By default SSHD in linux instances in AWS are started with password authentication set to NO. For good resaons. Clear text password authentication is NOT as secured.
However for development instances or sandboxes, it might provide a “convenience” that may be worth.
To enable password authentication to AWS linux instances, modify parameter PasswordAuthentication parameter in file sshd_config and then restart the sshd process.
For example…

1 root@domU-12-31-39-00-7C-94:[/etc/ssh]
2 $ pwd
3 /etc/ssh
4 root@domU-12-31-39-00-7C-94:[/etc/ssh]
5 $
6 $ vi sshd_config

In the VI editor…

1 # To disable tunneled clear text passwords, change to no here!
2 PasswordAuthentication yes # <<<< we enabled this!!!!
3 #PermitEmptyPasswords no
4 # Changed to no per AWS
5 #PasswordAuthentication no

Now restart SSHD process.

01 $ sshd
02 sshd re-exec requires execution with an absolute path
03 root@domU-12-31-39-00-7C-94:[/etc/ssh]
04 $ which sshd
05 /usr/sbin/sshd
06 root@domU-12-31-39-00-7C-94:[/etc/ssh]
07 $
08 root@domU-12-31-39-00-7C-94:[/etc/ssh]
09 $ service /usr/sbin/sshd restart
10 /usr/sbin/sshd: unrecognized service
11 root@domU-12-31-39-00-7C-94:[/etc/ssh]
12 $ service sshd restart
13 Stopping sshd: [ OK ]
14 Starting sshd: [ OK ]
15 root@domU-12-31-39-00-7C-94:[/etc/ssh]
16 $

Now SSHD process is started with password authentication enabled. If we remove the key from the putty profle and open a telnet connection, we’ll be prompted for userid and password.
We should be able use a valid linux user with password to login.

1 login as: oracle
2 oracle@ec2-23-22-205-159.compute-1.amazonaws.com's password:
3 oracle@domU-12-31-39-00-7C-94:[/home/oracle]
4 $
5 oracle@domU-12-31-39-00-7C-94:[/home/oracle]
6 $
7 oracle@domU-12-31-39-00-7C-94:[/home/oracle]
8 $

That’s it. Be careful when using this technique.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s