Enabling SSH for A Headless Raspberry Pi

On November 30th, 2016, the Raspberry Pi Foundation decided to disable SSH by default in Raspbian for securing reasons. I understand the decision and fully support it. This, of course, is a little inconvenient for those of us that setup our Raspberry Pis as headless servers and don’t want to pull out peripherals and monitors every time we want a fresh setup. Luckily there’s a solution.

Simply create an empty file labeled ssh in the boot directory after the Raspbian image is installed.

$ touch /bootmountpoint/ssh

Google Drive Utility On Raspberry Pi

I’ve finally gotten back to updating and reconfiguring my Raspberry Pi 2 as a headless server and was browsing the forums to see if there’s any other services that I can add. I came across a post on how to add a push and pull utility for Google Drive. Apparently, a Googler, Burcu Dogan, that works on the Drive team abandoned the drive project that can be used on a Linux system and Emmanuel T Odeke has since picked it up.

Here are the directions for installing it on the Raspberry Pi:

See what version of ARM processor you are using (ARMv6, ARMv7, ARMv8, etc.).

$ cat /proc/cpuinfo | grep "model name"

Browse the drive releases and copy the latest arm binary release URL.

Make the Google Drive directory.

$ mkdir /your/drive/directory

Download the drive binary.

$ wget https://github.com/odeke-em/drive/releases/download/v0.3.4/drive-armv6 -O /usr/local/bin/drive

Make the binary executable.

$ sudo chmod +x /usr/local/bin/drive

Initialize drive

$ drive init /your/drive/directory

Open up the Oauth2 link in a browser, copy the key, and paste it into the Raspberry Pi console.

You should be good to go!

Tested on:

  • 05/02/2016
  • drive v0.3.4
  • Raspberry Pi 2 (BCM2709)
  • Raspbian Jessie (8)

Get Notified When Your Raspberry Pi is Booted with Pushbullet

When working with a headless Raspberry Pi, it’s nice to know when it’s back up and running during a restart. An easy way of becoming notified when your RPi is finished booting is to have it send a notification through the phenomenal service, Pushbullet. According to their website:

Pushbullet connects your devices, making it easy and automatic to share almost anything between them.

Through Pushbullet’s API, you can send yourself notifications to your desktop or to your phone.

Pushbullet Setup Instructions

The first thing you need to do is create a Pushbullet account.

Then install their mobile app for Android or iPhone, or Firefox or Chrome extension.

Grab your Pushbullet access token from your account page.

Test that Pushbullet is working from your RPi command line using curl.

$ curl -u <your_access_token_here>: https://api.pushbullet.com/v2/pushes -d type=note -d title="Raspberry Pi" -d body='Raspberry Pi is up!'

Raspberry Pi Setup Instructions

We’re going to send our Pushbullet command using the rc.local file which is executed once our RPi has finished booting.

Make a backup of your rc.local file.

$ sudo cp /etc/rc.local /etc/rc.local.backup

Open up the rc.local file using nano.

$ sudo nano /etc/rc.local

Add the curl command right before the exit 0 command.

curl -u <your_access_token_here>: https://api.pushbullet.com/v2/pushes -d type=note -d title="Raspberry Pi" -d body='Raspberry Pi is up!'

exit 0

Restart your RPi

$ sudo reboot

You should get a notification that your RPi is up.


Reformat a Raspberry Pi SD Card Using Diskpart in Windows 7

In can be tricky reformatting a Raspberry Pi SD card in Windows 7 due to the multiple partitions that Raspian creates.  Here’s a simple way using the built in Diskpart in Windows 7.

Insert the SD card into an SD card reader and open a Windows command prompt console and start Diskpart.


List all of your disks.

DISKPART> list disk

Select your SD card disk.

DISKPART> select disk <#>

List all of your disks to ensure that the correct disk is selected – the selected disk will have an asterisk next to it.

DISKPART> list disk

Clean the disk.


Create a primary partition.

DISKPART> create partition primary

Create and format the primary filesystem.

DISKPART> format fs=fat32 quick

Assign the disk to a Windowsdrive letter so it shows up in Windows Explorer.

DISKPART> assign

Your disk is now ready for use.


Updating the System Time on a Raspberry Pi

The Raspberry Pi for some reason does not properly update the system time automatically.  To do this, simply install ntpdate.

View your current date and time:

$ date

Install ntpdate:

$ sudo apt-get install ntpdate

To update the time zone, simply remove the current local time file and make a new symbolic link to your timezone file:

$ sudo rm /etc/localtime
$ ls /usr/share/zoneinfo
$ ls /usr/share/zoneinfo/America
$ sudo ln -s /usr/share/zoneinfo/America/Los_Angeles /etc/localtime

Restart the ntp service:

$ sudo service ntp restart

Check the date again:

$ date

Your Raspberry Pi time should now be set!