查看: 2893|回复: 1

[教程] 【一网打尽】LEARN RASPBERRY PI (6 of 13)

[复制链接]
  • TA的每日心情
    开心
    2016-8-4 10:56
  • 签到天数: 242 天

    连续签到: 1 天

    [LV.8]以坛为家I

    发表于 2015-3-30 21:30:32 | 显示全部楼层 |阅读模式
    分享到:
    Overview SIMON MONK

    In this lesson you will learn how to remote control your Raspberry Pi over your local network using Secure Shell (SSH).

    learn_raspberry_pi_putty_connected.png
    A common reason for remote controlling your Pi from another computer is that you may be using your Pi solely to control some electronics and therefore not need a keyboard, mouse and monitor, other than for setting it up.
    It also can just save on desktop clutter, and the problem of having multiple keyboards and mice all over the place.

    Enabling SSH SIMON MONK

    Secure Shell (SSH) is a feature of Linux that allows you to effectively open a terminal session on your Raspberry Pi from the command line of your host computer.
    Recent versions of Rasbpian enable SSH access by default.  On older installations, you can use Raspi Config, which you first saw back in Lesson 2.
    In order to do this, open LX Terminal on your Pi and enter the following command to start Raspi Config:

    Copy Code


    • sudo raspi-config

    learn_raspberry_pi_starting_raspi-config.png
    Scroll down to the “ssh” option.

    learn_raspberry_pi_raspi_config_ssh1.png
    Hit the Enter and then select “Enable”

    learn_raspberry_pi_raspi_config_ssh2.png
    A script will run and then you will see the following as confirmation:

    learn_raspberry_pi_raspi_config_ssh3.png
    Using SSH on a Mac or Linux SIMON MONK

    Now switch over to using the computer from which you wish to control the Pi.
    If you are using a Mac or Linux PC then open a Terminal. On the Mac, you can find this in the Utilities folder of your Applications folder.
    Enter the following command into the Terminal window.

    Copy Code


    • ssh 192.168.1.13 -l pi

    Note that you will need to replace the IP address above with that of your Pi. You can find this by running the command “sudo ifconfig” from the Terminal.

    learn_raspberry_pi_finding_ip_address.png
    learn_raspberry_pi_mac_ssh.png
    The option “-l pi' specifies that we want to log into the Pi as the user “pi”. The first time you run the command, you will get a security warning about not being able to verify the identity of the machine, say that you want to continue and enter your password (“raspberry” by default) when prompted.
    You will notice that the command prompt will change to indicate that you are now connected to your Pi. Try using the “ls” command to show the contents of the current folder on the Pi.

    SSH under Windows SIMON MONK

    If you use windows, then you will need to download a free program called “PuTTY” from here:http://www.putty.org/.
    Having downloaded and installed PuTTY (it's a single file called putty.exe), run the program.

    learn_raspberry_pi_putty_config.png
    Enter the IP address that you found earlier and click “Open”. This will give you a warning (the first time) and then prompt you for the user (“pi”) and password (“raspberry”).

    learn_raspberry_pi_putty_warning.png
    The ssh window will then be ready for use.

    learn_raspberry_pi_putty_connected (1).png
    For a good example of how to use ssh to remotely configure a raspberry Pi, take a look at this tutorial:
    http://learn.adafruit.com/raspberry-pi-e-mail-notifier-using-leds/overview

    Test & Configure SIMON MONK

    Try exploring your files system by using 'ls' to list the files in the current directory and 'cd' followed by a directory name to change the current directory.
    You can edit files using 'nano' followed by the file name and also install software using the 'apt-get' command, as described in some of the earlier tutorials in this series.

    When finished with your ssh session, close the client application/window or simply type in exit into the shell window.

    Troubleshooting
    If you encounter a connection reset by peer error when trying to connect to your Pi, there could be a problem with the SSH keys. You can 'reset' the keys with the following commands.
    First, remove the old keys:
    sudo rm /etc/ssh/ssh_host_*
    Then regenerate them
    sudo dpkg-reconfigure openssh-server
    Then try again!












    回复

    使用道具 举报

  • TA的每日心情
    奋斗
    2016-1-19 22:39
  • 签到天数: 303 天

    连续签到: 1 天

    [LV.8]以坛为家I

    发表于 2015-3-30 22:45:02 | 显示全部楼层
    参考了,学习了
    回复 支持 反对

    使用道具 举报

    您需要登录后才可以回帖 注册/登录

    本版积分规则

    关闭

    站长推荐上一条 /3 下一条



    手机版|小黑屋|与非网

    GMT+8, 2024-5-11 10:54 , Processed in 0.124664 second(s), 18 queries , MemCache On.

    ICP经营许可证 苏B2-20140176  苏ICP备14012660号-2   苏州灵动帧格网络科技有限公司 版权所有.

    苏公网安备 32059002001037号

    Powered by Discuz! X3.4

    Copyright © 2001-2024, Tencent Cloud.