SSHing from an Macbook M1 to a Raspberry Pi
I've been wanting to learn how to utilize the Secure SHell protocol, or SSH.
I tried it, and it does not disappoint! So what is it?
With the SSH command and knowledge of a device's username, password, and host information access a network-connected device's terminal from another network-connected device, securely.
What does that mean? Well, you can go play around in another computer's terminal from another device! SSH is a Secure Shell, and you can use a simple "ssh" command to start an SSH session on another device.
In this example, I used my M1 Macbook to SSH into my Raspberry Pi 4. I opened up Terminal in Mac. Once the command line is open, you can start an SSH session with the following command:
example@Macbook-Air ~ % ssh [user]@[host/ipaddress]In this example, I used my M1 Macbook to SSH into my Raspberry Pi 4. I opened up Terminal in Mac. Once the command line is open, you can start an SSH session with the following command:
so if you're trying to SSH into a Raspberry Pi, you'd type something like:
example@Macbook-Air ~ % ssh pi@124.56.211.5
Of course, I encountered a problem. I had not enabled SSH access on my Pi. So I looked up how to do it, and it's a simple process:
open a terminal in your pi and enter the command
pi@user $ sudo raspi-config
This brings up a menu for the Pi's Software Configuration Tool, then you can enable by doing the following:
Select "Interface Options":
Then select "SSH" and tap "Enter" to toggle enable/disable
After enabling SSH on the Pi, I went back to my Macbook and ran the ssh command again. After you connect to the host, you'll need to enter the password for the device you're trying to SSH into. If you do this successfully, you're in your target device. From my Macbook, I was able to look through my Pi's directories and files, create files, view netstat info, and everything you might do if you were directly connected to the Pi hardware.
What power! Next, I decided to try doing it from my iPhone by using the terminal emulator app iSH, and through the same process described above. iSH is a pretty interesting little app, it creates an Alpine Linux terminal on your iPhone you can use. It's pretty lightweight and some standard commands aren't working at the moment, like ifconfig. I'll talk a little bit more about this in a later post, but the takeaway here is you can do a terminal SSH from your phone using a free, open-source app!
Comments
Post a Comment