tags:

views:

18

answers:

1

I created a new ebs backed EC2-instance and the necessary key-pair. Now I am able to connect to the instance as ubuntu user. Once i did that I created another user and added it to the sudoers list but I am unable to connect to the instance as the new user I created.

I get the following error. I am using the same key to connect with the new user i created. Can somebody help me. Am I missing something here?

Permission denied (publickey)"
A: 

Okay I think i figured it out.

The first technique is to login by password. The idea is to login as the ubuntu user or root user and go to /etc/ssh/sshd_config file and turn the PasswordAuthentication to yes and run /etc/init.d/ssh reload

If you try to connect now you ec2 allows you to log with the password of the user that was created. Though this is not really secure.

Second is you create a key-pair and copy the id-rsa.pub file and move it to the /home/new-user/.ssh/authorized_keys file and change permissions to 600 and assign to the appropriate user(new-user in this case).

I found this to be amazingly useful http://blog.taggesell.de/index.php?/archives/73-Managing-Amazon-EC2-SSH-login-and-protecting-your-instances.html

Sid