2

So I have a brand new RasPi 3, and I'm having SSH trouble. Yes, I have enabled SSH.

My problem matches exactly what is described here:

I just bought a new Raspberry Pi 3 and was not able to connect via SSH, even after creating an empty /boot/ssh file. SSH client under linux showed the following:

$ ssh -v 192.168.0.32 OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014 debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 19: Applying options for * debug1: Connecting to 192.168.0.32 [192.168.0.32] port 22. debug1: Connection established. debug1: identity file /home/vlad/.ssh/id_rsa type -1 debug1: identity file /home/vlad/.ssh/id_rsa-cert type -1 debug1: identity file /home/vlad/.ssh/id_dsa type -1 debug1: identity file /home/vlad/.ssh/id_dsa-cert type -1 debug1: identity file /home/vlad/.ssh/id_ecdsa type -1 debug1: identity file /home/vlad/.ssh/id_ecdsa-cert type -1 debug1: identity file /home/vlad/.ssh/id_ed25519 type -1 debug1: identity file /home/vlad/.ssh/id_ed25519-cert type -1 debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.8 debug1: Remote protocol version 2.0, remote software version OpenSSH_6.7p1 Raspbian-5+deb8u3 debug1: match: OpenSSH_6.7p1 Raspbian-5+deb8u3 pat OpenSSH* compat 0x04000000 debug1: SSH2_MSG_KEXINIT sent Connection closed by 192.168.0.32

The proposed solution is to run the following sudo commands:

$ sudo rm -r /etc/ssh/ssh*key
$ sudo dpkg-reconfigure openssh-server`

My question is whether there is any chance to apply this fix, or another one, in headless mode, i.e. without keyboard and screen. I have neither in my home, just laptops.

  • if you have linux on one of those laptops then you should be able to do a loopback mount of the fs and repair the ssh configuration. – lossleader Aug 25 '17 at 20:29
  • I have access to the card on a Ubuntu VM. How would you proceed from there? – DCS Aug 26 '17 at 15:51
1

On your other Linux system:

mount the drive, i.e:

sudo mkdir /b
sudo mount /dev/mmcblk0p2 /b

remove the old ssh host keys as in the instructions:

sudo rm /b/etc/ssh/ssh*key
sudo rm /b/etc/ssh/ssh*key.pub 

Replace the keys:

You can't run the reconfigure safely, so you could either:

  • not create keys and see if the next boot detects the need to run keygen, or:
  • clone your VM's keys to your RPi:

    sudo cp /etc/ssh/sshkey /b/etc/ssh/

But remember to cleanly unmount before removing the card:

sudo umount /b
  • Thanks for the detailed reply! Unfortunately I was so extremely frustrated in the meantime that I wiped the card and re-installed the minimal version of Raspian (which better suits my headless needs anyway). There, I got SSH to work, following the docs. So I could not test your solution. Not sure about policy of accepting here... I appreciate the help! – DCS Aug 26 '17 at 21:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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