Introduction: Connect Raspberry Pi to MacOS or Linux Using SSH

You can use SSH to connect to your Raspberry Pi from a Linux computer or Mac (or another Pi) from the Terminal, without installing additional software.

This is really useful if you want to run your Pi as a 'headless' machine without the need for its own monitor, mouse and keyboard - instead you can use your home computer, ipad or even mobile phone to access and control your Pi.

Step 1: Find Your Pi's IP Address

You'll need to know your Pi's IP address to connect to it.

To find this from your Pi's terminal

type hostname -I

Step 2: Connect Using Pi's IP Address

To connect to your Pi from a different computer, copy and paste the following command into the terminal window but replace with the IP address of the Raspberry Pi.

You can use Ctrl + Shift + V to paste in the terminal.

ssh pi@<Pi's IP address>

If you receive a 'connection timed out' error it's likely that you've entered the wrong IP address for the Raspberry Pi.

Step 3: Connect to the Pi

When the connection works you'll see a security/authenticity warning. Type yes to continue. You'll only see this warning the first time you connect.

In the event your Pi has taken the IP address of a device to which your computer has connected before (even on another network), you may be given a warning and asked to clear the record from your list of known devices. Following this instruction and trying the ssh command again should be successful.

Step 4: Login to Raspberry Pi

Next you'll be prompted for the password for the pi login, by default on Raspbian the password is raspberry.

You should now have the Raspberry Pi prompt which will be identical to the one found on the Raspberry Pi itself.

If you have set up another user on the Pi, you can connect to it the same way, replacing the username with your own, e.g. ved@

pi@raspberrypi ~ $

You are now connected to the Pi remotely and can execute commands.

For further documentation on the ssh command just enter man ssh into the Terminal.


IanA19 made it!(author)2015-10-31

I can't seem to do it through mac terminal, or linux terminal. I keep getting

dfs____@ubuntu:~$ ssh pi@<pi ip address>

ssh: connect to host <pi ip address> port 22: Connection refused

Any idea what that could be? I've enabled ssh through my pi already, and the ip address is correct as I use "hostname -i" to find it.

audstanley made it!(author)2015-11-02

If you connect the pi ethernet to you laptop, you still have to share you wifi to ethernet so you laptop will assign an IP address to the pi. The laptop will issue the DHCP lease, and then you can run sudo arp-scan -eth0 -l (lowercase L at the end there).

audstanley made it!(author)2015-10-29

In case you don't want to plug your pi into a keyboard, mouse, and monitor. Just plug your pi ethernet directly into your laptop, share wifi to ethernet on your mac, ubuntu, or linux mint laptop, and open your laptop terminal. Run sudo apt-get install arp-scan. Install it. Then run sudo arp-scan -I eth0 -l (that's dash upercase i, dash lowercase L).

Your laptop terminal will display the ip address and you can ssh pi@10.whatever.0.whatever from you laptop.

VedangR made it!(author)2015-10-31

What exactly does arp-scan do?

audstanley made it!(author)2015-11-02

Scans your interface (wlan0 or eth0) for connected devices on the network.

seamster made it!(author)2015-10-29

Good instructions, thank you for sharing this!

About This Instructable



More by VedangR:CONNECTING TO A RASPBERRY PI OVER VNC USING MAC OSConnect Raspberry pi to MacOS or Linux using SSH
Add instructable to: