In this post, you'll learn how to access your Pi's terminal from another computer. This can be especially helpful when running headless operations. For more info on headless operation, check out our tutorial here.
What You'll Need
- Raspberry Pi running Raspbian OS
- A separate computer running Windows, Linux, or MacOS
- A stable internet connection on both the Pi and the secondary computer
- Extremely basic understanding of the terminal (both on the Pi and the secondary computer)
- Basic understading of how to boot up and log in to a Pi
The first step is to connect both the Pi and the secondary computer to the same Wi-Fi network. IMPORTANT: Make sure the you trust the Wi-Fi you are using and that it is secure, as using SSH could potentially expose your data to anyone with access to your network. It is recommended that you use a home network (DO NOT use a public network), and be sure to terminate the session when you are finished.
Setting up the Pi
Next we'll need to actually enable SSH on the Pi.
With the Pi booted and connected to Wi-Fi, open a new terminal window and enter the following command:
Upon hitting 'Enter', the window should change to a screen that looks something like this:
Scroll down and select 'Interface Options' then scroll again and select 'SSH'.
Once you get a message that the SSH is enabled, click 'OK' and 'Finish' and you should be returned to the original terminal.
Getting the Pi's IP
Now that SSH is enabled, all we need to do is access it. But to do that we need the Pi's IP address.
If you don't already know the IP address of your Pi, open a terminal window (the one from earlier is fine) and type the command:
This should return a long string of numbers. The first group is the IP address. It should be something like this format:
Save this number, but don't give anyone else access to it as this could seriously compromise the integrity of any data on your computer or the Pi.
Accessing the Pi
Now, on the secondary computer, connect to the same Wi-Fi as the Pi and open a new terminal window. In the terminal enter the following command:
Obviously, you'll need to replace IP_ADDRESS with the number from earlier.
After hitting 'Enter', you may need to type 'yes' to agree to safety warnings, enter your password, and finally you should see the Pi terminal appear:
If you get a 'Connection timed out' error, you most likely entered the IP address wrong or are not connected to the same network as the Pi.
You should now be able to access the Pi's terminal from another computer. This can be very useful when doing things like running headless tasks, remote shutdown, etc. Remember to excersize caution when using SSH, as it essentially exposes the Pi to your network. Thus, anyone with your network credentials could access it. Avoid using SSH on unsecured or public networks.