# SSH and SCP

Through the `ssh.sh` and `scp.sh` scripts provided by FIRERPA, you can SSH into the device's shell terminal or copy files between your PC and the device.

## Prerequisites

Before using, ensure the FIRERPA server is running properly on the device and that you have completed the [tool preparation](./tools-prepare.md) on your PC (cloning the lamda repository, installing dependencies, setting `CERTIFICATE`/`PORT`, etc.). If the server has enabled [server certificate](./server-certificate.md), you also need to set the `CERTIFICATE` environment variable to the PEM file path.

## SSH Connection

Replace `192.168.1.2` with your device IP:

```bash
bash ssh.sh 192.168.1.2
```

```{note}
The built-in SSH service starts with FIRERPA by default. It can be controlled via sshd.enable; see [Service Configuration](./properties.md) for details.
```

## SCP File Transfer

Copy the `/sdcard/DCIM` directory from `192.168.1.2` to the current directory:

```bash
bash scp.sh 192.168.1.2:/sdcard/DCIM .
```

Copy the local directory `test/` to the `/sdcard/` directory on device `192.168.1.2`:

```bash
bash scp.sh test/ 192.168.1.2:/sdcard/
```

```{tip}
You can also use the Python API in [File I/O](./file-io.md) to upload or download files within your scripts.
```