So I wanted to call two background ssh processes:
ssh -D localhost:8087 -fN aws-gateway-vpc1
ssh -D localhost:8088 -fN aws-gateway-vpc2
These gateways don't have the benefit of letting me set an authorized_keys file, so I must be prompted for my interactive password. That is why I'm using the -f
flag and not the shell's &
which will only background the process after I authenticate interactively.
In this scenario I appear to be unable to use the $!
bash variable to get the pid of the recently [self] backgrounded process.
What other options do I have to find the correct pid to kill later if interrupted?