Controlling the Pi Remotely with SSH
You want to connect to a remote Pi from another computer using Secure Shell (SSH).
The easiest way to set up SSH on the Raspberry Pi is to use the raspi_config application, which launches the first time that you boot up your Raspberry Pi with Raspbian. You can also start this at any time by entering the following command in Terminal:
$ sudo raspi-config |
Scroll down to the SSH option and enable it.
On newer versions of Raspbian, SSH is automatically enabled and there is no setting to change.
If you are using a Mac or have Linux installed on the computer from which you want to connect your Pi, then all you need to do to connect is open a Terminal window and enter the command:
$ ssh 192.168.1.12 -l pi |
where the IP address is the IP address of your Pi (see Recipe 2.2). You will be prompted for your password and then logged in to the Pi (Figure 2-6).
To connect from a Windows computer, you will need to use Putty (Figure 2-5) to start an SSH session.
Discussion
SSH is a very common way of connecting to remote computers; any commands that you could issue on the Pi itself, you can use from the secure shell. It is also, as the name suggests, secure since the communication is encrypted.
Perhaps the only drawback is that it is a command-line rather than graphical environment. If you need access to the full Raspberry Pi desktop environment remotely, then you need to use VNC (Recipe 2.8).
See Also
See also this Adafruit tutorial.