How to enable SSH in Raspberry Pi? (Headless)

by Apr 26, 2020Raspberry Pi

What is SSH?

The SSH protocol (also referred to as Secure Shell) is a method for secure remote login from one computer to another. It provides several alternative options for strong authentication, and it protects the communications security and integrity with strong encryption.

In our case we use our Desktop/Android device to logic to our Raspberry Pi remotely.

What will be covered?

  • STEP 1: Download and setup Raspbian OS
  • STEP 2: Enable SSH
  • STEP 3: Connect to a network(wifi or LAN)
  • STEP 4: Find the IP address of your Pi
  • Final STEP: SSH login

STEP 1: Download and setup Raspbian OS

Note:Skip this step if you have already setup the Raspbian in pi beforehand.
  • Next, download and install BalenaEtcher from here.
  • Insert SD card to your computer and open BalenaEtcher .
  • Select the raspbian image you downloaded earlier.
  • Select your SD card
  • Finally click on Flash!
It will take some time(Have patience  or a cup  of tea :P) to complete the Flashing process.

Finally This part is done!!

STEP 2 : Enable SSH

  • First, remove and reinsert SD card to the computer once it is flashed.

In Linux :

Simply open a terminal and create a file named “ssh” in the boot directory of the SD cardby using the below command

nano ssh

In Windows:

  • First, open the boot” Directory from “This PC“.
  • Next,Create a new “text document” like this in the “boot” directory named ssh
  • Now we need to remove the extension of this file i.e from “ssh.txt” to “ssh”
  • For this go to the view tab and check the checkbox “File name extensions” under Show/hide.
  • Now,your file will look like this(Extension is displayed along with file name)
  • Next just rename the file and remove the extension.
  • Once done the file type will change to “File” from “Text Document

That is it. With the next boot, SSH will be enabled.

STEP 3: Connect to a network(wifi or LAN)

First Method -Using LAN or Ethernet: In this method just connect your Pi to your router using an ethernet cable and power on the Pi. This will automatically connect your Pi to your local network.

Second Method Using Wifi: For this, we need to add another file inside the “boot” directory with the file name “wpa_supplicant.conf

  • Now open this file “wpa_supplicant.conf” with any text editor(i used notepad) and type the following and save it:
country=IN
update_config=1
ctrl_interface=/var/run/wpa_supplicant

network={
scan_ssid=1
ssid="Replace with your wifi name/SSID"
psk="Replace with the wifi password "
}

Country Code should be set using the ISO/IEC alpha2 code for the country.

This part is done !!

STEP 4: Find IP address of your Pi

To connect to your Raspberry Pi remotely, you need two things (we’ll help you find them):

  • Its IP address on the local network
  • An SSH client (SSH is a communication protocol between machines)

First power on the pi and wait for few seconds for the pi to boot up.

Next, we need to find the IP address of pi on your network. For this we can use any method

I use an app called Network Scanner to find the ip address.(playstore link)

Final Step :SSH login

Now open Cmd in windows or Terminal in linux and type:

ssh pi@192.168.31.6

Here my IP address was “192.168.31.6”.Replace with your IP address.

  • Type yes and press Enter.
  • Now enter the password as “raspberry”.[This is the default password.]
Note: when you type the password it is not visible on the screen .This is normal no need to worry.just type it and press enter.
  • Now you have access to the command line of your Raspberry Pi remotely from another computer or device on the same network using SSH.

That’s it !! You have successfully connected via SSH into Pi.

Creating a multiplication Skill in Alexa using python

Written By Monisha Macharla

Hi, I'm Monisha. I am a tech blogger and a hobbyist. I am eager to learn and explore tech related stuff! also, I wanted to deliver you the same as much as the simpler way with more informative content. I generally appreciate learning by doing, rather than only learning. Thank you for reading my blog! Happy learning!

RELATED POSTS

How to Setup an NGINX Server on Raspberry Pi ?

How to Setup an NGINX Server on Raspberry Pi ?

What is NGINX ? NGINX is a popular lightweight web server application you can install on the Raspberry Pi to allow it to serve web pages. In its initial release, it functioned for HTTP web serving. It is a web server that can also be used as...

FM Radio Transmitter with Raspberry Pi

FM Radio Transmitter with Raspberry Pi

We’ve all listened to the radio and sang along to the songs, atleast in the car. But have you ever found yourself switching through several channels because you couldn’t find even one song that YOU like? In this article we will learn how to build a FM radio...

Raspberry Pi Camera and its Variety

Raspberry Pi Camera and its Variety

Choosing a suitable raspberry pi camera for your projects can get really difficult. RPI camera v1, RPI camera v2, RPI NOIR camera, and the list continues. Each one has different properties and should be used according to them. They have been used in various fields and...

WiFi extender using Raspberry Pi

WiFi extender using Raspberry Pi

It is always useful to know how to use your Raspberry Pi in pet projects that are actually useful around the house. Especially when you aren’t building something new – using your dormant Raspberry Pi to build useful devices around the house is a fun idea. If you are...

Using Raspberry Pi as various Servers

Using Raspberry Pi as various Servers

Raspberry Pi is a widely popular SoC, that is versatile and easy to use for even beginners. If you are new and are unfamiliar with Pi, take a look at these articles. Regardless of the model of Raspberry Pi you have, I am sure you have discovered a plethora of projects...

SQLite Database on Raspberry Pi

Welcome to another tutorial on Raspberry Pi. In this tutorial, we will see how to use the SQLite Database on Raspberry Pi. Apart from the installation and a few basic commands, in the end, we shall look at a simple project to log sensor data into an SQLite database....

Mosquitto MQTT Broker on Raspberry Pi

This tutorial will show you what is Mosquitto MQTT Broker and how to install it on Raspberry Pi. Contents What is MQTT?Installing Mosquitto MQTT on Raspberry PiCreating an MQTT Broker on Raspberry PiSubscribe to a TopicPublish a message to a TopicSample...

Evolution of the Raspberry Pi – A Comparison

Evolution of the Raspberry Pi – A Comparison

The Raspberry Pi is an inexpensive credit card-sized micro-computer. The Raspberry Pi was originally designed as a way to teach how computers work and the rest of computer science in general. It was originally developed in the UK by a team that included Eben Upton,...

Recording audio on your Raspberry Pi

Recording audio on your Raspberry Pi

Raspberry Pi can record and playback fairly good quality audio through its USB 2.0 ports. For recording audio and playback we need two peripheral devices, a USB microphone, and a speaker. You can choose to use a USB speaker, or a speaker with a 3.5mm sound jack....

Tutorial: Dropbox with Raspberry Pi

Tutorial: Dropbox with Raspberry Pi

Many Raspberry Pi projects require synchronization of files over more than just one device. Dropbox, which is a popular file-hosting service, can be used for this with ease. Synchronizing data between different devices may seem a little tricky, especially since the...

Creating a Raspberry Pi Network Scanner

Creating a Raspberry Pi Network Scanner

The Raspberry Pi network scanner that we will be creating in the following tutorial will scan through your local network and get the local IP address and MAC address of all devices connected to your network. To achieve this we are going to use the scapy module in a...

VIDEOS – FOLLOW US ON YOUTUBE

EXPLORE OUR IOT PROJECTS

IoT Smart Gardening System – ESP8266, MQTT, Adafruit IO

Gardening is always a very calming pastime. However, our gardens' plants may not always receive the care they require due to our active lifestyles. What if we could remotely keep an eye on their health and provide them with the attention they require? In this article,...

How to Simulate IoT projects using Cisco Packet Tracer

In this tutorial, let's learn how to simulate the IoT project using the Cisco packet tracer. As an example, we shall build a simple Home Automation project to control and monitor devices. Introduction Firstly, let's quickly look at the overview of the software. Packet...

All you need to know about integrating NodeMCU with Ubidots over MQTT

In this tutorial, let's discuss Integrating NodeMCU and Ubidots IoT platform. As an illustration, we shall interface the DHT11 sensor to monitor temperature and Humidity. Additionally, an led bulb is controlled using the dashboard. Besides, the implementation will be...

All you need to know about integrating NodeMCU with Ubidots over Https

In this tutorial, let's discuss Integrating NodeMCU and Ubidots IoT platform. As an illustration, we shall interface the DHT11 sensor to monitor temperature and Humidity. Additionally, an led bulb is controlled using the dashboard. Besides, the implementation will be...

How to design a Wireless Blind Stick using nRF24L01 Module?

Introduction Let's learn to design a low-cost wireless blind stick using the nRF24L01 transceiver module. So the complete project is divided into the transmitter part and receiver part. Thus, the Transmitter part consists of an Arduino Nano microcontroller, ultrasonic...

Sending Temperature data to ThingSpeak Cloud and Visualize

In this article, we are going to learn “How to send temperature data to ThingSpeak Cloud?”. We can then visualize the temperature data uploaded to ThingSpeak Cloud anywhere in the world. But "What is ThingSpeak?” ThingSpeak is an open-source IoT platform that allows...

Amaze your friend with latest tricks of Raspberry Pi and Firebase

Introduction to our Raspberry Pi and Firebase trick Let me introduce you to the latest trick of Raspberry Pi and Firebase we'll be using to fool them. It begins with a small circuit to connect a temperature sensor and an Infrared sensor with Raspberry Pi. The circuit...

How to implement Machine Learning on IoT based Data?

Introduction The industrial scope for the convergence of the Internet of Things(IoT) and Machine learning(ML) is wide and informative. IoT renders an enormous amount of data from various sensors. On the other hand, ML opens up insight hidden in the acquired data....

Smart Display Board based on IoT and Google Firebase

Introduction In this tutorial, we are going to build a Smart Display Board based on IoT and Google Firebase by using NodeMCU8266 (or you can even use NodeMCU32) and LCD. Generally, in shops, hotels, offices, railway stations, notice/ display boards are used. They are...

Smart Gardening System – GO GREEN Project

Automation of farm activities can transform agricultural domain from being manual into a dynamic field to yield higher production with less human intervention. The project Green is developed to manage farms using modern information and communication technologies....