| Summary: | provide a way to have forwardings killed, when the remote command/shell finishes | ||
|---|---|---|---|
| Product: | Portable OpenSSH | Reporter: | Christoph Anton Mitterer <calestyo> |
| Component: | ssh | Assignee: | Assigned to nobody <unassigned-bugs> |
| Status: | NEW --- | ||
| Severity: | enhancement | CC: | djm, dtucker |
| Priority: | P5 | ||
| Version: | 9.0p1 | ||
| Hardware: | Other | ||
| OS: | All | ||
|
Description
Christoph Anton Mitterer
2022-07-06 07:34:39 AEST
I think you can do what you're describing on the command line, something like: $ ssh -L 1234:127.0.0.1:5900 yourserver 'vncserver; kill $PPID' I assume your idea here is that this kills the server side ssh process and thereby also the forwarding, which isn't closed because of whathever happens between remmina and vnc? I tried it and while it works in principle it seems rather a hacky workaround: - the ssh client gives an error message as the connection is not cleanly shut down - exit status becomes 255 and not the one with which the remote command exits You could also do this using the multiplexing control socket and -O cancel > You could also do this using the multiplexing control socket and -O cancel
But AFAIU, this I'd need to do on the local side in an extra command.
So when I have some:
$ ssh foo.example.org
which sets up the forwarding and does via RemoteCommand start the remote service... and that then "hangs" because the forwarding is kept open even after the RemoteCommand has finished,... I would need to run the cancel command from somewhere else, i.e. manually.
So that's merely "as good" as manually doing a Ctrl-C.
AFAIK this would work:
ssh -oControlMaster=auto -oControlPersist=1s \
-oControlPath=/path -L[forward] user@host command ; \
ssh -oControlPath=/path -Oexit user@host
|