Reputation: 318
I saw many posts having same problem but without answer or real solution. I have raspberry pi 3 and I installed latest version of rasbian. I have neither monitor nor keyboard, so I would like to setup my raspberry through SSH. It's been 3 days I'm trying to connect but I'm always getting this error:
Connection closed by {ip} port 22
Any help would be greatly appreciated!
Upvotes: 4
Views: 5619
Reputation: 1267
After many tries, I connected a monitor and discovered in the end that my image was broken. The raspberry stopped with a kernel panic.
Upvotes: 0
Reputation: 1304
It seems newer versions of Raspbian disable ssh by default:
In the past, SSH was enabled by default, so people using their Pi headless could easily update their SD card to a new image. Switching SSH on or off has always required the use of raspi-config or the Raspberry Pi Configuration application, but to access those, you need a screen and keyboard connected to the Pi itself, which is not the case in headless applications. So we’ve provided a simple mechanism for enabling SSH before an image is booted.
The boot partition on a Pi should be accessible from any machine with an SD card reader, on Windows, Mac, or Linux. If you want to enable SSH, all you need to do is to put a file called ssh in the /boot/ directory. The contents of the file don’t matter: it can contain any text you like, or even nothing at all. When the Pi boots, it looks for this file; if it finds it, it enables SSH and then deletes the file. SSH can still be turned on or off from the Raspberry Pi Configuration application or raspi-config; this is simply an additional way to turn it on if you can’t easily run either of those applications.
So to enable sshd for one boot touch /mnt/raspi/boot/ssh
.
To then enable sshd permanently you can run raspi-config
and select to start SSHd. There should be a way to do that manually, too, but I haven't yet figured that out.
Upvotes: 2