Pi My Life Up

Raspberry Pi SSH: How to SSH into Raspberry Pi


Raspberry Pi SSH is a way we’re able to communicate to the Pi over a network so we no longer need to be physically located near the Pi.

SSH or secure shell for anyone who is unfamiliar with the term is a common cryptographic protocol for communication over networks. It allows us to be able to use command-line without actually being on the Pi. This is fantastic for a lot of Raspberry Pi projects that don’t actually require you to be on the Pi itself.

If you want to see it done visually then check out my video below, if you like my stuff please subscribe so you can stay up to date on all the latest and greatest Raspberry Pi projects, guides and much more.

Equipment

This is the equipment that I have used in this guide.

Raspberry Pi

Keyboard

Mouse

Power Supply

Raspberry Pi Case

Ethernet Cord or Wifi dongle

How to SSH into Raspberry Pi

Firstly we will need to have Raspbian installed if you haven’t installed it then check out my installing NOOBS Raspberry Pi. This will take you through all the steps you need to do before you start this guide.

Enabling Raspberry Pi SSH Server

The Raspberry Pi SSH Setup requires us to use the raspi-config tool to enable it. In order to do this we will need a keyboard, mouse and a screen for the Pi. Once we have done this we will no longer any of these items.

1. First turn on and login to the Raspberry Pi. (Remember default username is pi and password raspberry)

2. If you need the IP Address now would be a good time to get it. To do this simply type:

hostname -I

3. Now type the following command:

sudo raspi-config

4. Now in here go to Interfacing Options->SSH (Previously Advanced Options->SSH)

5. Enable SSH and reboot the Pi.
Now that we have enabled SSH we will need to connect from another computer.

Windows: SSH Raspberry Pi

If you’re a windows user then this process is pretty straight forward. We will need to get a free application called Putty first and use that to simply connect to the Raspberry Pi SSH.

1. To SSH on windows we will need an additional tool called Putty. You can download putty.

2. Download the putty.exe under “For Windows on Intel X85”

3. Now once that is installed load the putty.exe

4. In this screen we will need to input the IP of the Raspberry Pi into the Host Name Field.

5. The port should be 22

6. Now click on open

7. You will be prompted with a security alert, simply click yes to this.

8. Now login with the default username pi and password raspberry. (Unless you have already changed this)

You’re now able to connect to the Pi and send commands remotely rather than needing to be at the Pi itself.

Mac: SSH to Raspberry Pi

To connect to the Raspberry Pi SSH on mac or Linux is very easy all we need to do is connect using the terminal.

If you’re using a Mac then we will be able to use terminal to simply connect. If you’re using a mac this is found under utilities within the applications folder.

1. First, open the terminal.

2. Replacing 192.168.1.103 with your own Raspberry Pi IP address issue the following command.

ssh pi@192.168.103

3. You will now receive a security warning type yes to continue.

4. You should now be prompted for the password for the user pi. The Raspberry Pi default password is simply raspberry.

5. You should now be able to control the Raspberry Pi through the terminal.

Troubleshooting

If you’re having trouble trying to get this to work here are a few tips you can try to get the connection to work.

“I am getting a connection error”

Ensure you have the correct IP address and you have also enabled SSH in the raspi-config

Make sure the Pi is connected to the same network as you are on. (Unless of course you have setup port forwarding and connecting outside the network)

“I am getting access denied”

Make sure you are using the correct password, the default is raspberry but remember you may have changed it earlier.

I hope this guide has shown you how to SSH to the Raspberry Pi however if you’re still having trouble feel free to drop us a comment below. (Also feel free to comment on anything regarding this guide)

19 Comments

Will on October 26th, 2015 at 1:01pm
We were able to get the surveillance camera to work on the local network but am unable to access it outside the network. Any tutorials on this? Thanks. Will
Gus on October 26th, 2015 at 3:58pm
Hi Will, If you follow my port forwarding tutorial this will help you with allowing outside access to it. You can find the full tutorial here: http://pimylifeup.com/raspberry-pi-port-forwarding/ I recommend using a random port for the external port but the internal port will need to 80.
Mike on December 2nd, 2015 at 1:27am
Any advice when getting "Network Error: connection timed out."? I'm new to all this and have found that port 22 may be blocked but not too sure how to change that on my pi. Could this me correct? Also, what else could be the problem? Any ideas/advice would be appreciated.
Gus on December 7th, 2015 at 8:31pm
If your connection is timing out then either the port 22 is blocked, you're connecting to the wrong IP or you have SSH disabled on the Pi. To enable it on the Pi you need to do the following: In the command line: sudo raspi-config This will open up settings. Go to Advanced Options and then SSH. Enable SSH then exit and reboot the Pi.
RLPendergast on April 16th, 2016 at 3:44am
Hi, Your presentations are excellent both in content and clarity. However, I need to know, how do I reboot or shutdown the RPi from the remote terminal? the screen say I am not authorized and use (pi) or root, but I am not sure what that means and using these two choices with reboot or shutdown -h now did not work. Thanks rlp
Gus on April 17th, 2016 at 3:59pm
The command sudo reboot should reboot your Pi from the remote terminal. Let me know if that helps!
RLPendergast on April 17th, 2016 at 9:16pm
Thanks.
Brendan Brooks on July 26th, 2016 at 10:55am
I'm getting an access denied error message. I tried changing the password on the pi using sudo passwd, but I'm still receiving the error. Any ideas?
joe reid on August 21st, 2016 at 7:50am
i am a huge fan of your guides , but with all due respect this thread should be entitled " how to connect to your pi remotely " not " how to control your pi remotely " , i have connected no probs but i haven't a clue how to access the browser or open files or play videos or in fact do anything with pi when using command box ?
Mike G. on January 21st, 2017 at 2:44pm
Your instructions on where to find the option to enable SSH is wrong. Instead of being under "Advanced Options", the setting is found under "Interfacing Options".
Gus on January 21st, 2017 at 2:46pm
They were correct, Raspbian has updated recently and changed the location. I will update the tutorial so it's up to date with the latest version.
Nix on February 19th, 2017 at 4:16pm
I am new to raspberry Pi, using raspberry pi 2 model b, after installing raspbian-jessie, and entering login:pi and password:raspberry , getting error accces denied on putty.
Simon on February 21st, 2017 at 2:38am
Just a quick comment regarding recent updates to Raspbian (inc. Jessie) where SSH is disabled by default. When you first setup a Pi from an image file, if you, like me, don't have the peripherals (keyboard/mouse/monitor) around, putting a file (even an empty one) called ssh in /boot will enable SSH on boot up meaning you can do everything "headless". I haven't explained any further because if what's above doesn't make sense to you, you should probably be setting your Pi up with the peripherals rather than "headless" and blind (I do not intend any disrespect to anyone by that comment) Cheers Simon
Simon on February 21st, 2017 at 2:43am
And another option with Windows 10 now is to use the "Bash on Ubuntu on Windows" if you have that installed (enable in Windows Features | Windows Subsytem for Linux (Beta))
Sav on February 27th, 2017 at 5:40am
What is generally range of raspberry pi IP address ??? Any idea ? Thanks
Gus on March 7th, 2017 at 7:46pm
Whatever your router/DHCP server can assign to it, if you're trying to find out the actual IP address of the Pi then the command hostname -I will return it.
Morten on May 18th, 2017 at 5:39am
Hello Gus. Thanks for all the guides, i'm trying to access my PI on my mobile (not from the local network). i forwarded port 80 to the PI and then tried to connect from the external IP address but i get this error: "Connecting to xx.xx.xx.xx port 80, please wait.... Failed to connect to xx.xx.xx.xx: Connection refused." i got my PI as an always on torrent box + NAS and it works perfectly, also the access from another computer etc. Regards Morten
Jonathan on July 3rd, 2017 at 6:46am
Did you enable ssh of the rpi
Sean on October 17th, 2017 at 12:39am
Just something to note, I was able to work on my Pi by hooking onto ethernet and then accessing my router to find the Pi's IP before ssh; beforehand while setting up the SD card I made sure to make an empty "ssh" file before I ejected it. So with that I could theoretically set up headlessly through and through.