# Control a Raspberry Pi Remotely

If you don't have a monitor, keyboard, and mouse connected to the device, you
can still control the device remotely via SSH.

- [Ethernet/Wi-Fi option](https://developers.google.com/assistant/sdk/guides/service/python/embed/setup-headless#headless-network-access)
- [USB TTL option](https://developers.google.com/assistant/sdk/guides/service/python/embed/setup-headless#usb-ttl-network-access)

## Ethernet/Wi-Fi option

1. [Enable SSH on a headless Raspberry Pi](https://www.raspberrypi.org/documentation/remote-access/ssh/) (see section "Enable SSH on a Headless Raspberry Pi").
2. Plug in an ethernet cable.
3. Power on the Raspberry Pi.
4. [Find the Raspberry Pi IP
   address](https://www.raspberrypi.org/documentation/remote-access/ip-address.md).
5. If you prefer to use ethernet, skip to the next [section](https://developers.google.com/assistant/sdk/guides/service/python/embed/setup-headless#ssh).
6. If you prefer to use Wi-Fi, first connect via [USB-TTL](https://developers.google.com/assistant/sdk/guides/service/python/embed/setup-headless#usb-ttl-network-access). Then:
   - [Connect to a Wi-Fi network using the command
     line](https://www.raspberrypi.org/documentation/configuration/wireless/wireless-cli.md).
   - [Find the Raspberry Pi IP address for the Wi-Fi
     connection](https://www.raspberrypi.org/documentation/remote-access/ip-address.md).
   - Re-connect via [SSH](https://developers.google.com/assistant/sdk/guides/service/python/embed/setup-headless#ssh) using this Wi-Fi IP address.

## USB-TTL option

1. [Get console access using a USB-TTL
   cable](https://learn.adafruit.com/adafruits-raspberry-pi-lesson-5-using-a-console-cable/overview).
2. Plug in an ethernet cable or [connect to a Wi-Fi network using the command
   line](https://www.raspberrypi.org/documentation/configuration/wireless/wireless-cli.md).

## Connect to the Raspberry Pi via SSH

To run commands on the Raspberry Pi, you need to open the [terminal](https://www.raspberrypi.org/documentation/usage/terminal/)
on the device or use an SSH connection. You must use an SSH connection from your
development machine if you do not have a monitor, keyboard, and mouse connected
to the Raspberry Pi.

Make sure [SSH is enabled](https://www.raspberrypi.org/documentation/remote-access/ssh/README.md)
on the Raspberry Pi.

```
ssh pi@raspberry-pi-ip-address
```

```
password: password-for-raspberry-pi
```

For example:

```
$ ssh pi@192.168.1.101
password: raspberry
```

On Raspbian, the default password for the `pi` user is `raspberry`. You should
change this password immediately (run `passwd` in a terminal on the Pi).

Use the terminal or the SSH session you set up in this step to enter the
commands in the rest of this guide. The working directory for both is
`/home/pi`.