Skip to content

Commit

Permalink
Improve SSH tunnel documentation in README
Browse files Browse the repository at this point in the history
  • Loading branch information
rom1v committed Nov 19, 2021
1 parent 6da6d90 commit 2d6a967
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -416,32 +416,44 @@ autoadb scrcpy -s '{}'

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_
protocol):
protocol).

First, make sure the ADB server is running on the remote computer:

```bash
adb start-server
```

Then, establish a SSH tunnel:

```bash
adb kill-server # kill the local adb server on 5037
ssh -CN -L5037:localhost:5037 -R27183:localhost:27183 your_remote_computer
# local 5038 --> remote 5037
# local 27183 <-- remote 27183
ssh -CN -L5038:localhost:5037 -R27183:localhost:27183 your_remote_computer
# keep this open
```

From another terminal:
From another terminal, run scrcpy:

```bash
export ADB_SERVER_SOCKET=tcp:localhost:5038
scrcpy
```

To avoid enabling remote port forwarding, you could force a forward connection
instead (notice the `-L` instead of `-R`):

```bash
adb kill-server # kill the local adb server on 5037
ssh -CN -L5037:localhost:5037 -L27183:localhost:27183 your_remote_computer
# local 5038 --> remote 5037
# local 27183 --> remote 27183
ssh -CN -L5038:localhost:5037 -L27183:localhost:27183 your_remote_computer
# keep this open
```

From another terminal:
From another terminal, run scrcpy:

```bash
export ADB_SERVER_SOCKET=tcp:localhost:5038
scrcpy --force-adb-forward
```

Expand Down

0 comments on commit 2d6a967

Please sign in to comment.