- Raspberry Pi Zero Cookbook
- Edward Snajder
- 456字
- 2021-07-09 19:12:11
SSHing your RPZ from your desktop computer
The ideal way to talk to your Raspberry Pi Zero is using Secure SHell (SSH). This gives you a secure, encrypted channel to talk to your Pi from anywhere on the network. For example, let's say you want your Pi to collect temperature information from your attic and make it available on your home network. You don't want to drag a monitor, mouse, and keyboard up to your attic every time you want to make a change-you want to do it from your regular home computer! If you have your RPZ using Wi-Fi, on the network, and ping-able, the next step is to work with it remotely over SSH. Here's how.
Getting ready
If you are using a Windows machine, PuTTY is the way to go, just like a serial connection. If you are on OSX or Linux, SSH should be installed and available using any terminal window. You'll also need the IP address of your Raspberry Pi Zero.
If you ran through the earlier recipe to enable SSH using the rasp-config
utility covered in Chapter 1, Kick-Start your Raspberry Pi Zero, then you should be set to go.
How to do it...
- Talking to your Raspberry Pi Zero over SSH is quite simple. On OSX or Linux, use this command:
ssh pi@192.168.2.118
You will be prompted for your password; after entering it, you will be in your Zero's terminal.
- On Windows, open PuTTY and enter the address in the Host Name box. Select
SSH
for the connection type. Click on Open, and PuTTY will open the terminal window. You can also Save the session to connect quickly in the future.
At this point, you are connected remotely to your Raspberry Pi over an encrypted connection. If your network speeds are acceptable, you should find this to be a much faster connection than the USB-serial connection used earlier. The serial connection is great for troubleshooting, especially when you can't see your Pi Zero on the network. Once that's functioning normally, you'll probably find the SSH terminal the fastest and easiest way to get connected, especially if you don't want your keyboard and monitor connected to your Raspberry Pi Zero (they are much harder to carry in your bag that way).
Once you are connected, you can use it just like you used the serial connection. You'll find that you probably want to use this one, as your home network is probably quite a bit faster than your direct serial connection. If you have your Wi-Fi adapter connected, you can put your Raspberry Pi Zero anywhere it can get power and is within reach of a known Wi-Fi network.
Here is what a typical successful SSH connection would look like:

- Hands-On Artificial Intelligence on Amazon Web Services
- Practical Data Wrangling
- 計算機應用基礎·基礎模塊
- Hands-On Data Science with SQL Server 2017
- IoT Penetration Testing Cookbook
- Expert AWS Development
- iClone 4.31 3D Animation Beginner's Guide
- Splunk Operational Intelligence Cookbook
- LAMP網站開發黃金組合Linux+Apache+MySQL+PHP
- 過程控制系統
- 智能鼠原理與制作(進階篇)
- 基于Proteus的單片機應用技術
- 計算機應用基礎實訓(職業模塊)
- Access 2007數據庫入門與實例應用金典
- 教育創新與創新人才:信息技術人才培養改革之路(四)