I have just installed the 2012-09-18-wheezy-raspbian onto SD and plugged it into my pi. According to this question, SSH should be enabled by default. I can see the pi on the network (it responds to ping) and if I do nmap:

nmap -p 22 --open -sV
Starting Nmap 5.21 ( http://nmap.org ) at 2012-10-24 20:29 BST
Nmap scan report for
Host is up (0.00063s latency).
22/tcp open  ssh     OpenSSH 6.0p1 Debian 1 (protocol 2.0)
Service Info: OS: Linux

but when I try to ssh:

ssh -p 22 [email protected]

I get

Read from socket failed: Connection reset by peer

I haven't got a suitable monitor so it's pretty hard to diagnose the problem. I checked an the symlinks to /etc/init.d/ssh are already in the runlevel directories as /etc/rc$i.d/S02ssh for i={1..5} (as per this answer). Any other ideas?

1 Answer 1


It appears that the host key files are missing or corrupt. To correct it try this.

sudo rm /etc/ssh/ssh_host_* && sudo dpkg-reconfigure openssh-server

ref: http://www.raspberrypi.org/phpBB3/viewtopic.php?f=27&t=15814

  • Hmm, but how can I run this without shell access? I'll check /var/log/regen_ssh_keys.log when I get home
    – tdc
    Oct 25, 2012 at 8:11
  • Can you connect a tv? Oct 25, 2012 at 8:18
  • With a bit of hassle yes ... I was hoping I'd just be able to ssh straight into it as it's supposed to be enabled by default.
    – tdc
    Oct 25, 2012 at 8:32
  • You could try reimaging the card and reinstalling. This seems to be a fairly rare occurance. Oct 25, 2012 at 8:36
  • Ok I'll try that. It was a fresh image though (although I was overwriting a previous squeeze image), so that seems a bit odd. Unless it's something on the client side (ubuntu)??
    – tdc
    Oct 25, 2012 at 8:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.