[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A background ssh can take over the tty from bash?

From: Chet Ramey
Subject: Re: A background ssh can take over the tty from bash?
Date: Mon, 12 Jun 2017 10:48:24 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.1.1

On 6/11/17 10:24 PM, Clark Wang wrote:
> On Mon, Jun 12, 2017 at 5:48 AM, Chet Ramey <address@hidden
> <mailto:address@hidden>> wrote:
>     On 6/10/17 10:19 AM, Clark Wang wrote:
>     > If I kill the "ssh -o ControlMaster=no -o ControlPath=/tmp/socket.tmp
>     > sleep 9999" then tty #1 (pts/11) would be able to accept my 
> input
>     > again. Seems like the background "ssh" at tty #1 is consuming all 
> input. I
>     > cannot understand this since it should be stopped by SIGTTIN if it 
> tries to
>     > read from the tty.
>     This has come up before. You need to use `ssh -n' to avoid it reading from
>     stdin. Processes can ignore SIGTTIN, and ssh does so to avoid being 
> stopped
>     if it reads from the tty while in the background.
> I've checked the ssh process and it does not catch SIGTTIN and that's why
> I'm confused.

OK. This has gone beyond the realm of a bash bug. I'm pretty sure that
previous versions of ssh ignored or caught SIGTTIN, but it must not do that

Since ssh has a handle on its controlling terminal, it must do something
that allows it to read from it even if it's not in the foreground process
group. In any event, -n is the way to deal with that.

``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]