Many times, a situation arises for an IOT developer where he/she wants to ssh onto a newly flashed raspberry pi running on Ubuntu/Raspbain but without a Monitor and keyboard or any other input device.
The first and foremost thing to SSH into a pi is to open port 22. But its always closed for security purposes. When we have a pi with a keyboard and monitor its easy to open the port but that isn’t the case always. Here we will explain how to open port 22 and enable ssh without any input device.
Open Port 22 in Raspbian/Ubuntu for SSH
Without wasting time we will straight tell you to steps to open port 22
- Prepare your sd card using Etcher and your OS image (or Mount flashed SD card)
- Navigate to the SD card [boot] using your OS file manager or terminal
- Create a new empty file named ssh, without any extension, inside the boot directory [touch /boot/ssh]
- Remove the SD card from your computer and put it in your Raspberry Pi.
- Power on your Pi board. On boot Pi will check whether this file exists and if it does, SSH will be enabled and the file is removed.
That’s it, now connect your raspberry pi to your network via LAN, find the IP address from your Router’s console and ssh onto it. If you want to SSH to your Pi from a different network – Click Here.