Re: A background ssh can take over the tty from bash?
From:
Clark Wang
Subject:
Re: A background ssh can take over the tty from bash?
Date:
Tue, 13 Jun 2017 10:16:49 +0800
On Tue, Jun 13, 2017 at 2:48 AM, L A Walsh <bash@tlinx.org> wrote:
> Clark Wang wrote:
>
>>
>> I've checked the ssh process and it does not catch SIGTTIN and that's why
>> I'm confused.
>>
>>
> ----
> From what I understand, a background process will automatically
> block when it tries to read from STDIN. By definition, processes
> become bg-processes by using '&'. I haven't looked at the
> code, but I'm guessing that the first 'ssh' that you launched
> (*without* the '&') is the process swallowing your input as
> it was declared to be a some sort of master-multiplexer for
> subsequent slave processes, but that's just a guess. Maybe
> putting the master in background @ launch (using '&') will
> cause it to auto-block(suspend) as you expect?
>
The first ssh (with `-f`) would fork another ssh running as a daemon which
would detach from the current tty. It makes no difference whether to use
`&` or not. Please see my explanation @stackoverflow:
https://stackoverflow.com/questions/44492312/ .
-clark