Читать книгу Raspberry Pi For Dummies - McManus Sean, Evans Jonathan, Sean McManus - Страница 41

Connecting Using SSH

Оглавление

If your Raspberry Pi has a network connection, you should be able to access it with another computer on the same network using Secure Shell (also known as SSH), which is a way to make a secure connection between computers. This can be helpful if you have set up your Pi to use it headerless (without a screen). Here's how to set it up:

1 Change your password.To prevent unauthorized access to your Raspberry Pi after a remote connection is enabled, start by changing your password. You can use the Raspberry Pi Configuration tool (see “Configuring Your Raspberry Pi in Raspberry Pi OS,” earlier in this chapter), or see Chapter 5 for instructions on changing the password in the command line.

2 Enable SSH on your Pi.Use the Raspberry Pi Configuration tool to enable SSH on the Interfaces tab. Alternatively, use this instruction to create an empty file in the boot directory called ssh and then reboot your Pi:sudo touch /boot/ssh

3 Get your Pi's IP address.Use ifconfig in the command line to get your Raspberry Pi’s IP address (shown as inet on wlan0 for a WiFi connection or on eth0 for an Ethernet connection).

4 Connect from your other device.In Windows 10, macOS, and Linux, the SSH software is already installed. You can use it from the command line by typing in ssh pi@198.51.100.0. You replace the numbers with your Raspberry Pi's IP address. If you changed the username on your Raspberry Pi, change pi too. If you’re using a computer that doesn’t have SSH software, or you prefer to use a graphical interface, you can download an SSH client such as Putty. In Putty, you input the IP address of your Raspberry Pi and click the Open button. After you enter your Pi’s password, you can use the command line on the Raspberry Pi to manage and fix files, viewing it through your PC screen and using your PC keyboard. SSH apps are also available for the iPhone/iPad and Android. You can find fuller instructions for using SSH on your other machine at www.raspberrypi.org/documentation/remote-access/ssh.

You can only use SSH to access the Raspberry Pi command line, not the desktop.

Raspberry Pi For Dummies

Подняться наверх