Raspberry Pi and SSH: How-to Setup a Headless Machine (No Monitor) and Pasword-less Logins

Raspberry Pi and SSH: How-to Setup a Headless Machine (No Monitor) and Pasword-less Logins

SSH is the staple of any remote access setup.  Setting it up on the Raspberry Pi (RPi) is ideal since the device is so small.  Instead of hooking it up to a monitor, keyboard, and mouse, it is much better to simply access it remotely from another computer.  Having the ability to not type in a password will also make life much easier.

Requirements For This Walkthrough


  1. Mac running OS X
  2. Raspberry Pi running Raspbian “wheezy”
  3. Ethernet cable(s) or Wi-Fi


  1. Homebrew (optional)
  2. nmap via Homebrew (optional)
  3. iNet Pro (for iOS)
  4. AngryIP Scanner (optional)
  5. Any other sort of network scanner that will provide IPs of devices on the network

Knowledge, Skills, and Abilities

  1. Ability to navigate throughout a computer OS
  2. Knowledge of basic computer terminology
  3. Knowledge of IP addresses
  4. Ability and confidence to enter commands in Terminal (modifying them to suit your environment)

Find the IP of the RPi Using nmap, AngryIP Scanner, or Another Device

In order to set up a Raspberry Pi that does not have a monitor, keyboard, or mouse, it is necessary to find the IP address so it can be configured from a different computer via SSH.  There are a few options for this (order of most-useful and easiest-to-install to the least effective)


Find the Pi’s IP address using nmap from the command line:


iNet Pro

  1. Connect your iDevice to the network
  2. Scan the network using iNet Pro

AngryIP Scanner

This method is the least effective since you only will be able to see the IP address and not any information about what device is what.

  1. Scan the network using AngryIP Scanner
  2. Try logging into each active IP address using the steps below using the process of elimination

SSH into the RPi Once You Know It’s IP Address

From Terminal, you need to log into the Pi

ssh pi@<ip_address_of_pi>

log in using the default password of raspberry .

Update the Pi Before Doing Anything Else

sudo apt-get update sudo apt-get upgrade

Run raspi-config  to Set Common Options

sudo raspi-config

Enable the following settings

Expand file system Change user password Set a hostname Enable SSH

Reboot to Apply All Changes

Generate SSH Keys on Your Mac (Not the RPi) For Password-less Logins

First, generate a private/public pair of SSH keys.

ssh-keygen -t rsa cat ~/.ssh/id_rsa.pub | ssh pi@<ip_address_of_raspberry_pi> "mkdir .ssh;cat >> .ssh/authorized_keys"

Replace <ip_address_of_raspberry_pi>  with the IP address of the RPi.  This command will copy the public key generated on the Mac into the authorized_keys file on the Pi.  You will need to enter the password of the pi user to execute this command.  If you try to SSH into the machine after this command, no password will be required.

Harden SSH

If the RPi will be accessible over the Internet, some safeguards should be taken to secure the device.

sudo vi /etc/ssh/sshd_config

Change the following settings to no, uncommenting if necessary.

PermitRootLogin No PasswordAuthentication No

Alternatively, you could also change the port to a different number for a little security by obscurity.