Created
May 12, 2022 02:42
-
-
Save gnachman/21200f5f1647c7db43eb397d19910ee9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
User runs `ssh-wrapper example.com` | |
`ssh-wrapper` does: | |
`ssh example.com /usr/bin/env sh -c "$(cat conductor.sh)" | |
Where `conductor.sh` is a sh script that does something like (pseudoterminal below): | |
echo <control sequence to notify terminal emulator that it's in ssh mode> | |
run login shell as a child process through `script` on file descriptor 3 | |
while true: | |
output = [read from file descriptor 3 without blocking] | |
if output not empty: | |
echo "begin-output" | |
echo $output | |
echo "end-output" | |
command = [read from stdin without blocking] | |
if command: | |
echo begin-command-output | |
eval $command | |
echo end-command-output | |
The terminal emulator will have a mode that knows how to parse the "framed" output | |
and issue commands in place of the usual interaction between a terminal emulator and shell. | |
Furthermore, it can do file transfers, run `ps`, measure CPU utilization, kill jobs by PID | |
when the user requests it, etc. to enable a fancy UI over ssh. | |
its UI. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment