The Raspberry Pi is — as we’ve seen in several previous articles — an extremely flexible piece of hardware. Once you’ve installed an operating system, mastered the small footprint, and found a fit for it, you can install the media center software and maybe even start programming the software (after all, that’s what it was designed for). !).

However, you may find that connecting your Raspberry Pi to a large-screen plasma TV—the only device in your home with an HDMI connection—is a little tedious while your family is watching their favorite show. Also, you may have more than enough HDMI displays but not enough keyboards.

Benefits of SSH

Luckily, the Raspberry Pi can accept SSH commands when connected to a local network (via Ethernet or Wi-Fi), making it easy to set up.

SSH Benefits Don’t Limit Daily Browsing «The Simpsons» or breaking news about celebrities — using a Raspberry Pi without a dedicated display (also known as «headless») can allow you to leave the device in a certain configuration without worrying about someone getting in the way.

Using Pi as a NAS interface? No problem! If your Raspberry Pi spends its life as a low volume web server or internet radio, then it doesn’t need a dedicated display.

That’s where SSH comes in!

Setting up Raspberry Pi for SSH

To prepare your Raspberry Pi for remote SSH connections, you must first install the Debian Raspbian distribution as described earlier. SSH is enabled by default, but if you have it disabled, you must enter the configuration screen to re-enable it.

After connecting the mini computer to the network and connecting the keyboard and Ethernet cable, boot and log into the device.

raspberry pi setting

Once you have done this, enter sudo raspi-config, to open the configuration screen and use the arrow keys and Enter to select the Enable or Disable SSH option. On the next screen select «Enable», press «Enter» and again on the last screen «Enter» to select «OK».

Now that SSH is enabled, you should be able to remotely connect to your Raspberry Pi using an SSH client.

(Note that if SSH is not listed as a menu option, you are probably using an old build of the Raspbian distribution and should upgrade ASAP!)

Connecting to Raspberry Pi

Before connecting to Raspberry Pi, you need to check the IP address. There are several ways to do this.

set up a raspberry pi without a head

First, from the command line, type ifconfig to display network connection information, including the IP address. In addition, you can check the router for connected devices and thus determine the IP address.

With this information, you are ready to connect to SSH.

If you’re on Windows, the best SSH tool is probably PuTTY, available at http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html . After uploading (select putty.exe for this task), double-click the executable and it will run without installation.

raspberry pi setting

On the screen session add the IP address in the field host name and press open . PuTTY will give you a security notice — click » Yes», to continue, and log into your Raspberry Pi.

In a few minutes, you will see the Raspberry Pi text interface!

You can now disconnect your keyboard, mouse, and HDMI cable from your Raspberry Pi and execute commands remotely.

Issuing remote pi commands

Various commands can be sent remotely to the Raspberry Pi via SSH — pretty much anything that doesn’t disable or interrupt SSH or your network connection!

  ps ax 

This will display a list of running processes.

  $ ssh –V 

Displays the current version of SSH

Files can be copied to and from the Raspberry Pi using SSH:

  localhost $ логин scp: /home/username/remotehostfile.txt remotehostfile.txt 
  localhost $ scp localhostfile.txt имя пользователя: /home/username/localhostfile.txt 

Once you’re done, don’t forget to safely shut down the Pi with the command:

sudo shutdown -h now

(Changing -h to -r will reboot the device). This must be done before removing the power cable — if this is not done, it may damage the SD card, which will mean reinstalling the Raspian OS.

Updates, application installations and command line usage — Remote!

There are certain things that SSH is not good for. For example, it won’t let you access the Raspberry Pi GUI, but it will give you the means to run updates, install apps, and use various firmware and tools from another computer.

With a simple setup of SSH using the remote control and the commands listed above (and many more), you can quickly and efficiently send instructions to a device using PuTTY on Windows, or using built-in command line tools on Mac OS X and other Linux distributions.

In general, if you have a Raspberry Pi, you should know how convenient and useful SSH is. If you plan on using SSH regularly, you might want to learn how to hack this boot partition. hack hack to quickly enable SSH when you need it.

Похожие записи