Skip to content

Instantly share code, notes, and snippets.

@wey-gu
Last active October 14, 2024 11:32

Revisions

  1. wey-gu revised this gist Oct 14, 2024. No changes.
  2. wey-gu revised this gist Oct 14, 2024. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion expose_local_port_with_public_server_via_sshd.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    0. ensure remote server enables remote port fwd on non-loopback ip
    1. ensure remote server enables remote port fwd on non-loopback ip

    ```bash
    #/etc/ssh/sshd_config
  3. wey-gu revised this gist Oct 14, 2024. No changes.
  4. wey-gu renamed this gist Oct 14, 2024. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  5. wey-gu created this gist Oct 14, 2024.
    23 changes: 23 additions & 0 deletions .md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    0. ensure remote server enables remote port fwd on non-loopback ip

    ```bash
    #/etc/ssh/sshd_config
    GatewayPorts yes
    ```

    2. ssh

    ```bash
    ssh -R [remote_port]:[destination_address]:[local_port] [username]@[ssh_server]
    ```

    3. check listening hosts from remote server

    say remote_port is `18000`:

    ```
    $ ss -plunt | grep 18000
    Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
    tcp LISTEN 0 128 0.0.0.0:18000 0.0.0.0:* users:(("sshd",pid=2714723,fd=10))
    ```