Server refusing ssh keys?

dreamcompute

#1

Hi guys! I’m trying to set up my first instance on DreamCompute, following the guides here: http://wiki.dreamhost.com/DreamCompute_Getting_Started and http://wiki.dreamhost.com/SSH_Keys. Everything seems nominal, except I cannot log in to my instance at all: any attempt to connect through SSH results in “Permission denied (publickey).” (cygwin ssh) or “Server refused our key” (PuTTY). I’ve connected to other servers using ssh keys before using the exact same methods and never had any issues, but I can’t log in now for the life of me.

I’ve tried three different methods: generating a key pair in the dashboard & importing the private key into PuTTY & Cygwin SSH; generating a key pair using Cygwin SSH (“ssh-keygen -t rsa”); and generating a key pair using PuTTY Key Generator. All three keys are listed in the Key Pairs section of the dashboard.

Any options I’ve used to generate these pairs have been the defaults. I’m running Windows 8.1 and Cygwin x64. Any ideas what might be going on or how to resolve this?

Thanks so much for any help you can offer, it is greatly appreciated!


#2

Did you select the key when launching your instances? No keys are used by default. Check the “Access & Security” tab of the “Launch Instance” window.


#3

Yes, but that key doesn’t appear to work. Is there any way to change which key an instance uses? All I can find is editing security groups which I don’t think is what I want.

Edit
Ok, I managed to get it working using the dashboard-generated key and cygwin-ssh, and by deleting the old instance and creating a new one with the new key.

The question remains though—is there any way to change which key pair an instance uses?


#4

For an existing instance, not by using the DreamCompute Dashboard. If you can log into the instance, you can change the SSH keys just like normal (by editing /root/.ssh/authorized_keys), but if you’re locked out, you’ll have to destroy the instance and start over. The key settings in the dashboard are only applied on bootup.


#5

Cool, thanks for your (extremely prompt!) help!


#6

I also just set up a new account and instance and created a key pair on my mac client and imported the public key to my (ubuntu) instance. I tried to ssh to my new instance and it says"Permission denied (publickey).". I am not sure what to look for at this point.


#7

You’ll want to make sure you’re specifying the correct user and path to the key when you’re logging into the Ubuntu instance via SSH.

The default user we create on our images is called: dhc-user

And the default path to the SSH private key is: ~/.ssh/id_rsa

If you’re using the defaults, your SSH command should look like this:

ssh -i ~/.ssh/id_rsa dhc-user@1.2.3.4 (replacing 1.2.3.4 with your floating IP address)

If your key name is different, just replace ~/.ssh/id_rsa with the appropriate path to your key.

Hope that’s helpful! Let us know if you’re still having trouble.


#8

[hr]
bash-3.2$ ssh -i id_rsa dhc-user@1.2.3.4
Permission denied (publickey).

I imported a public key id_rsa.pub and soft restarted the instance (not sure if that was necessary).
My next attempt as shown above (from the .ssh dir) resulted in the same permission denied error.


#9

If you don’t mind, please submit a support ticket with the ssh command you’re using, with your floating IP address, so our team can help you troubleshoot.

https://panel.dreamhost.com/support


#10

Greetings,

It would be helpful if it was more clear that the default user to images is called dhc-user. I thought it was a placeholder and I was to use my dreamcloud user or something like that.

kind regards,

Brett


#11

Thanks Brett, that’s useful feedback!


#12

I spent hours blocked at ssh “Permission denied”, attempting to log-on to my DreamCompute instance as [font=fixed]@[/font], before finally trying [font=fixed]root@[/font], which told me I had to use [font=fixed]centos@[/font], which worked.

This should be mentioned in the control panel. There are no relevant instructions when creating a key, and the instructions on key import are vague and misleading:

[quote]After launching an instance, you login using the private key (the username might be different depending on the image you launched):

ssh -i cloud.key @<instance_ip>[/quote]

The use above of [font=fixed][/font] can mislead people into using their account username.

The in-panel docs should be changed.


#13

While we do have this documented in our Knowledge Base, I agree the default usernames are difficult to find if you’re not familiar with them.

We have a new cloud control panel we’re testing that makes this more clear. I’d recommend giving it a try!