Ubuntu – Locked out of the Slicehost.com Ubuntu box

slicehostsshUbuntu

— Latest Edit ———————————–

Thanks to all who helped but I'm still stuck. I'm desperate now. Any other processes to restart besides the sshd? I don't know which directions to go to? Any other ideas?


For a few months I managed to connect fine with ssh but I had to enter my password every time. I now forgot how far I went with the initial setup of ssh and keygen.

Anyway yesterday I tried to install the keys properly and go through the setup instructions found on this page.

I have to say that I did not do the steps related to the firewall. Upon completion of this command:

/etc/init.d/ssh reload

I have since been unable to log in through the key or the password way. Luckily I still had an ssh terminal session open so I could still tinker with it but did not manage to fix it. The Internet connection got interrupted this morning so that session is gone. Here is what I get when I run the 'ssh -p 30000 -v myuser@mydomain.com'

OpenSSH_5.1p1, OpenSSL 0.9.7l 28 Sep 2006
debug1: Reading configuration data /Users/swamiatma/.ssh/config
debug1: Reading configuration data /etc/ssh_config
debug1: Connecting to ohlalaweb.com [173.45.225.154] port 30000.
debug1: Connection established.
debug1: identity file /Users/swamiatma/.ssh/identity type -1
debug1: identity file /Users/swamiatma/.ssh/id_rsa type 1
debug1: identity file /Users/swamiatma/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_4.7p1 Debian-8ubuntu1.2
debug1: match: OpenSSH_4.7p1 Debian-8ubuntu1.2 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.1
debug1: SSH2_MSG_KEXINIT sent
Connection closed by 173.45.225.154

Thanfully Slicehost provides a console through their admin panel through which I can log on. Please help. First priority, how can I login anyway possible: enable telnet, ssh password login, etc ??

Answer to that emergency situation would be great. Next I'd like to go through the process of login through private/public key again. I guess I'll need some more understanding of the process first.

EDIT:
Here is the message I got from the auth.log

Aug  7 10:14:39 ohlala sudo: pam_unix(sudo:session): session closed for user root                                       
Aug  7 10:15:24 ohlala sshd[20217]: error: Could not load host key: /etc/ssh/ssh_host_rsa_key                           
Aug  7 10:15:24 ohlala sshd[20217]: error: Could not load host key: /etc/ssh/ssh_host_dsa_key                           
Aug  7 10:15:24 ohlala sshd[20218]: fatal: No supported key exchange algorithms 

Not sure what I can do about it.

EDIT 2:
Following rkthkr's advice I regenerated the server keys and here is the new error message I got.

Aug  7 12:07:50 ohlala sudo: pam_unix(sudo:session): session opened for user root by deploy(uid=0)                      
Aug  7 12:07:50 ohlala sudo: pam_unix(sudo:session): session closed for user root                                       
Aug  7 12:08:51 ohlala sshd[20362]: error: Could not load host key: /etc/ssh/ssh_host_rsa_key                           
Aug  7 12:08:51 ohlala sshd[20362]: error: Could not load host key: /etc/ssh/ssh_host_dsa_key                           
Aug  7 12:08:51 ohlala sshd[20363]: fatal: No supported key exchange algorithms                                         
Aug  7 12:09:15 ohlala sudo:   deploy : TTY=tty1 ; PWD=/home/deploy ; USER=root ; COMMAND=/usr/bin/tail -f /var/log/auth
.log -n 25                                                                                          
Aug  7 12:09:15 ohlala sudo: pam_unix(sudo:session): session opened for user root by deploy(uid=0)                      
Aug  7 12:09:15 ohlala sudo: pam_unix(sudo:session): session closed for user root

Best Answer

Looks like you have your server-keys missing/wrong permissions/corrupt:

Clue:

error: Could not load host key: /etc/ssh/ssh_host_rsa_key                   
error: Could not load host key: /etc/ssh/ssh_host_dsa_key

Permission should be owned by "root:root" and chmod 0600

To generate those keys:

ssh-keygen -f /etc/ssh/ssh_host_rsa_key -N '' -t rsa
ssh-keygen -f /etc/ssh/ssh_host_dsa_key -N '' -t dsa