Logging on to a Raspberry pi remotely

For anyone who has a Raspberry Pi (rPi), and wants to access it without having to attach a monitor and keyboard, here are some basic instructions on how to do that. A rPi just by itself is known as a “headless” rPi.

So first a little background. A computer attached to a network always has an IP address associated with it. An IP address is a number of the form .Most networks these days use DHCP IP address assignments, which means that each time a device leaves the network and returns, a new IP address is assigned to it. Each hardware device also has something known as a media access control address (MAC address) which is a unique identifier assigned to network interfaces for communications on the physical network. A MAC address looks like this: B8:27:EB:F2:37:11

So accessing a headless rPi basically involves attaching the rPi to your (wireless) router via the ethernet port (hard wired). Once it is attached to the router, it will be assigned an IP address. With this you can access the rPi and login to it. How do you go about finding this number? So if you have a Mac, you can use a program called Pi Finder. An alternative is to login to the router itself and look up the device table. The rPi will be the one with a MAC address that starts with “B8:27:EB“.

A third way is to find the rPi’s IP address is to use the utility nmap, which is available for OSX, Windows and Linux. Once installed, the following command can be issued on the command-line:

sudo nmap -sS 192.168.0.*

This will find all the devices on the local network, and return information about them. Note the use of the sudo command before nmap. This allows the command nmap to be run as root, the superuser. Why? So it actually displays the MAC address, so you know which IP address belongs to which device. It will prompt for a password – on a Macintosh this is the administrators password. The information generally looks like this:

Nmap scan report for
Host is up (0.0040s latency).
Not shown: 999 closed ports
22/tcp open ssh
MAC Address: B8:27:EB:F2:37:11 (Raspberry Pi Foundation)

On the first line you can see the IP address to use. Now it’s as simple as using the command ssh to login to your rPi:

ssh pi@

where pi is the default user on the Raspberry Pi and raspberry is the default password (note: change the password the first time you log in).


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s