3

I just got a RPi 3 model B and installed Raspbian on it. Using built-in WiFi, I connected it to my router and was able to download and install TightVNC. I installed RealVNC on my laptop and was able to connect to it with 192.168.1.14:1 address. This means that I should be able to connect through SSH as well.

I am able to ping from laptop to RPi, and with Windows firewall OFF I can ping from RPi to the laptop.

I then installed PuTTY on my laptop and (Running as Admin) tried to connect to 192.168.1.14 (all else left default) and got an error immediately with Windows firewall ON or OFF.

I get "Network error: Software caused connection abort" with Windows firewall ON: enter image description here

and "Server unexpectedly closed network connection" with Windows firewall OFF: enter image description here

(I guess, for now, ignore the message that comes up when the firewall is ON)

Console Logs read (had to type it out):

pi@raspberrypi:~ $ sudo service ssh status -l
  Loaded: loaded (/lib/systemd/system/ssh.service; enabled)
  Active: active (running) since Thu 2016-12-29 21:37:51 UTC; 3h 13min ago
Main PID: 506 (sshd)
  CGroup: /system.slice/ssh.service
          |-506 /usr/sbin/sshd -D
Dec 29 21:37:52 raspberrypi sshd[506]: key_load_public: invalid format
Dec 29 21:37:52 raspberrypi sshd[506]: Could not load host key: /etc/ssh/ssh_host_rsa_key
Dec 29 21:37:52 raspberrypi sshd[506]: Server listening on 0.0.0.0 port 22.
Dec 29 21:37:52 raspberrypi sshd[506]: Server listening on :: port 22.
Dec 29 21:37:52 raspberrypi sshd[506]: key_load_public: invalid format
Dec 29 21:37:52 raspberrypi sshd[506]: Could not load host key: /etc/ssh/ssh_host_dsa_key
Dec 29 21:37:52 raspberrypi sshd[506]: key_load_public: invalid format
Dec 29 21:37:52 raspberrypi sshd[506]: Could not load host key: /etc/ssh/ssh_host_ecdsa_key
Dec 29 21:37:52 raspberrypi sshd[506]: key_load_public: invalid format
Dec 29 21:37:52 raspberrypi sshd[506]: Could not load host key: /etc/ssh/ssh_host_ed25519_key

I tried disabling SSH in 'sudo raspi-config' in "Interfacing Options" and rebooting, then re-enabling it and rebooting.

If this is a special case, would reinstalling the OS help?

Thanks!

Edit1: I just checked, I get "Server unexpectedly closed network connection" with Windows firewall ON or OFF.

  • You can try creating a backup of the /etc/ssh directory with sudo mv /etc/ssh /etc/ssh.backup then deleting the directory with sudo rm /etc/ssh and then either restart the sshd service or just reboot the RPi with sudo shutdown -r now. – fvgs Dec 29 '16 at 21:30
  • 1
    @fvgs so you're suggesting to delete all keys and ssh-related config files to solve the issue. How would that help? – Ghanima Dec 29 '16 at 22:37
  • 1
  • 1
    I wouldn't advise manually deleting /etc/ssh. You can clean install OpenSSH using sudo apt-get purge openssh-server; sudo apt-get install openssh-server. – Hydraxan14 Dec 30 '16 at 2:45
  • @Ghanima The intended effect is the same as that of uninstalling and then reinstalling ssh to fix the corrupt config files. Programs like these typically create their default config files when they are found to be missing. Thus, by moving them to a backup directory, ssh would recreate its config files. To be fair, I'm not 100% certain if ssh adheres to this behavior (but that's why you create a backup first). Uninstalling and reinstalling is also fine, but not a desirable option for someone relying on ssh to connect to a headless setup. – fvgs Dec 30 '16 at 15:16
1

PuTTY Keys Incompatible

I see that your openssh log is complaining about a public RSA key being in the wrong format.

Please keep in mind that the keys generated by PuTTY are not compatible with the OpenSSH server (unless you export them to be compatible using PuTTYGen.)

Please see the PuTTY website for details.


Edit

Actually, that looks like it's complaining about the key in /etc/ssh/, not ~/.ssh/. Maybe your SSH server got corrupted somehow? You might try reinstalling it:

sudo apt-get purge openssh-server; sudo apt-get install openssh-server

  • Yes, reinstalling ssh helped =) – DemSec Dec 30 '16 at 5:31
  • @Hydraxan14 Before I reinstall, I want to make sure it can't be done via a putty? My Pi is headless. – Old Geezer Oct 19 at 9:27
0

You did not "install Pixel (powered by Raspibian" you installed Raspbian which includes Pixel as Desktop Manager (for those who use GUI).

You "install(ed) TightVNC" then "installed RealVNC" RealVNC is included by default, but tightvncserver and RealVNC are mutually incompatible.

I assume your real question is about ssh

As of the November 2016 release, Raspbian has the SSH server disabled by default. You will have to enable it manually.

  • 2
    ... but from the logs sshd seems to be running and reporting some issues with the key files. – Ghanima Dec 29 '16 at 10:05
  • "I installed RealVNC on my laptop". I just added to my post that I have checked my raspi-config ssh setting. – DemSec Dec 29 '16 at 20:30
  • @Ghanima I didn't (couldn't) read the "logs" - microscopic red on black! I assume people will actually describe their problem. – Milliways Dec 29 '16 at 22:29
  • 1
    You're right that posts should be clear without the screenshots and put the relevant logs into the post directly (see my comment to the OP). In this particular case however the resolution of the image (when clicking on them) is high enough to be readable. – Ghanima Dec 29 '16 at 22:47
0

Type command

sudo raspi-config

Go to the advanced and look for SSH service, enable it and restart SSH or machine for sure.

Other way is to create empty file named ssh on your raspbian sd card in boot.

  • Comments are not for extended discussion; this conversation has been moved to chat. – Ghanima Dec 29 '16 at 22:34

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.