You just flashed your SD card with latest Raspbian image and booted up your Raspberry Pi only to find out SSH is no more enabled by default. Now you're baffled, but don't worry it is not as difficult as it seems. Here's what you can do to enable SSH on your Pi:
- Mount SD card (2nd partition on SD card) on your laptop or computer.
- Create a file /etc/SSHFLAG (doesn't matter empty or write something to it) on the mounted partition.
- Edit /etc/rc.local and add these lines at the end:
- Unmount the SD card properly from your laptop/computer (by following whatever proper mechanism applies to your OS).
- Mount it on Pi and turn Pi on.
- Wait for a few minutes to let it boot fully.
- Try SSH now, you should be able to connect as long as you get the networking part right.
if [ -e /etc/SSHFLAG ]; then /bin/systemctl enable ssh /bin/rm /etc/SSHFLAG /sbin/shutdown -r now fi
Disclaimer: If you follow the information here, there is no warranty, I am not liable if it deletes your data, gets you hacked, burns your house down or anything else. If you follow the information contained here you do so entirely at your own risk. My views and opinions are my own and not necessarily represent the views of my current or former employers. © Raheel Hameed and www.raheelhameed.com, 2017. Unauthorized use and/or duplication of this material without express and written permission from this site’s author and/or owner is strictly prohibited. Excerpts and links may be used, provided that full and clear credit is given to author and this website with appropriate and specific direction to the original content.
Comments
Post a Comment