Improve SSH tunnel documentation in README

This commit is contained in:
Romain Vimont 2021-11-19 19:02:43 +01:00
parent 6da6d905c2
commit 2d6a96776c

View file

@ -416,17 +416,27 @@ autoadb scrcpy -s '{}'
To connect to a remote device, it is possible to connect a local `adb` client to To connect to a remote device, it is possible to connect a local `adb` client to
a remote `adb` server (provided they use the same version of the _adb_ a remote `adb` server (provided they use the same version of the _adb_
protocol): protocol).
First, make sure the ADB server is running on the remote computer:
```bash ```bash
adb kill-server # kill the local adb server on 5037 adb start-server
ssh -CN -L5037:localhost:5037 -R27183:localhost:27183 your_remote_computer ```
Then, establish a SSH tunnel:
```bash
# local 5038 --> remote 5037
# local 27183 <-- remote 27183
ssh -CN -L5038:localhost:5037 -R27183:localhost:27183 your_remote_computer
# keep this open # keep this open
``` ```
From another terminal: From another terminal, run scrcpy:
```bash ```bash
export ADB_SERVER_SOCKET=tcp:localhost:5038
scrcpy scrcpy
``` ```
@ -434,14 +444,16 @@ To avoid enabling remote port forwarding, you could force a forward connection
instead (notice the `-L` instead of `-R`): instead (notice the `-L` instead of `-R`):
```bash ```bash
adb kill-server # kill the local adb server on 5037 # local 5038 --> remote 5037
ssh -CN -L5037:localhost:5037 -L27183:localhost:27183 your_remote_computer # local 27183 --> remote 27183
ssh -CN -L5038:localhost:5037 -L27183:localhost:27183 your_remote_computer
# keep this open # keep this open
``` ```
From another terminal: From another terminal, run scrcpy:
```bash ```bash
export ADB_SERVER_SOCKET=tcp:localhost:5038
scrcpy --force-adb-forward scrcpy --force-adb-forward
``` ```