官术网_书友最值得收藏!

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...

  1. 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.

  2. 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:

主站蜘蛛池模板: 平邑县| 巴楚县| 松潘县| 塘沽区| 武川县| 巨鹿县| 屏东县| 龙州县| 调兵山市| 大港区| 南江县| 抚顺市| 都江堰市| 蕲春县| 湘西| 新乐市| 玛纳斯县| 雷州市| 张家口市| 冷水江市| 临海市| 象州县| 团风县| 锦屏县| 女性| 霍山县| 石屏县| 视频| 武强县| 平谷区| 桦南县| 普定县| 贡嘎县| 墨脱县| 景泰县| 四子王旗| 株洲县| 镇坪县| 延川县| 平武县| 县级市|