Skip to content

Instantly share code, notes, and snippets.

View SkyperTHC's full-sized avatar

skyper SkyperTHC

View GitHub Profile
@SkyperTHC
SkyperTHC / gist:cb4ebb633890ac36ad86e80c6c7a9bb2
Last active March 30, 2025 12:03
docker exec not sending SIGHUP to shell when docker-cli is killed?

Before we get to the problem we need to have a common understand of how PTYs work.

There are two sides: a master and a slave. The shell's STDIN/STDOUT/STDERR are connected to the slaves side the master (a single FD) is connected to .... normally sshd (when we log into a remote system).

The PTY takes care of special characters. Of course there is a PTY on the client side as well but the ssh client puts this into raw mode and it wont do anything. We can ignore this. Let's focus on the PTY on the server side.

The user presses Ctrl-c on the client side and the ssh client reads \003 (Ctrl-C character) and forwards this to the sshd server. The sshd server sends it to the MASTER end of the PTY.

$ thc-rfs mount aDe5F2ik3x35x7pfAEAWdC5Y ~/secure
@SkyperTHC
SkyperTHC / test.c
Created May 13, 2020 13:01
gistTest
int
main(int argc, argv)
{
exit(0);
}