Docs · Use

Forwards and exec.

Besides terminals, an osewa connection carries port forwards and commands. Each gets its own QUIC stream, so a big transfer never stalls your typing in another window.

Port forwarding

osewa forward works like ssh -L: it listens on a local port and carries each connection to a target the host can reach.

osewa forward devbox 3000                         # localhost:3000 -> the host's localhost:3000
osewa forward devbox 8080:localhost:3000          # localhost:8080 -> the host's localhost:3000
osewa forward devbox 5432:db.internal:5432        # a database the host can reach
osewa forward devbox 0.0.0.0:3000:localhost:3000  # listen on every interface here
osewa forward devbox 3000 5173 9229               # several at once

Each forward is [bind:]port[:host:hostport]. Two numbers alone, like 8080:3000, read as a bind address and a port, so write the target host when the ports differ:

It prints a line per forward and runs until you press Ctrl-C:

forwarding 127.0.0.1:3000 -> localhost:3000 on devbox

Like attach, forward survives network changes: it redials and keeps listening. A transfer that was open when the network dropped may need to be retried by the program using it.

Running commands

osewa exec runs a command on the host without a terminal. stdin, stdout and stderr pass through, so it works in pipes and scripts.

osewa exec devbox -- make test
osewa exec --cwd /srv/app devbox -- git status
osewa exec --env RUST_LOG=debug devbox -- cargo run
tar cz src | osewa exec devbox -- tar xz -C /tmp/copy

When the host refuses

A host's server can turn these off with --no-forward and --no-exec (see server flags). Then you get:

the host's server doesn't allow forwarding (--no-forward)
osewa: bad_request: the server does not offer exec

osewa update uses exec, so it can't update a host whose server runs with --no-exec.