bug-bash
[Top][All Lists]
Advanced

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

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 12:45:11 +0800

On Tue, Jun 13, 2017 at 11:00 AM, L A Walsh <bash@tlinx.org> wrote:

>
>    In this case you need to use "-n" with "-f" OR not use
> either if you wish it to be suspended.
>

I did want the `ssh -o ControlMaster=yes` to run as a daemon.


>    If I launch ssh without "-f" but put it in background, it doesn't
> grab the foreground terminal (and the DOES get suspended when it
> tries to do input).
>
> Please see my explanation @stackoverflow:
>> https://stackoverflow.com/questions/44492312/ .
>>
>>
> Seems to be saying similar -- that the demonizing process needs
> to be disconnected from stdin.
>

`-f` implies `-n` so it is effectively disconnected from the tty (though
it's still opening the tty device with FDs 0, 1, 2 but it would never read
from FD 0). The magic part here is it's the 2nd `ssh ... sleep` that asks
the 1st `ssh -o ControlMaster=yes` to open (by passing the FDs to it) the
tty again (with new FDs) and read from it.


> It doesn't mention that you can have it be suspended
> (as you seemed to expect), by not having it daemonize.
>

As I mentioned ealier, I don't want the `ssh -o ControlMaster=yes` to be
suspended.

-clark


reply via email to

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