bug-bash
[Top][All Lists]
Advanced

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

A background ssh can take over the tty from bash?


From: Clark Wang
Subject: A background ssh can take over the tty from bash?
Date: Sat, 10 Jun 2017 22:19:02 +0800

(I'm using bash 4.4.12 on Debian 8)

Please follow the following steps to reproduce.

>From tty #1:

$ tty
/dev/pts/11
$ ssh -o ControlMaster=yes -o ControlPath=/tmp/socket.tmp -N -f 127.0.0.1
root@127.0.0.1's password:
$ ps -C ssh uw
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root       716  0.0  0.2  44428   692 ?        Ss   22:04   0:00 ssh -o
ControlMaster=yes -o ControlPath=/tmp/socket.tmp -N -f 127.0
$
$ ssh -o ControlMaster=no -o ControlPath=/tmp/socket.tmp 127.0.0.1 sleep
9999 &
[1] 725
$    <-- Then I cannot input anything except CTRL-C

Go to tty #2:

$ ps t pts/11 jw
 PPID   PID  PGID   SID TTY      TPGID STAT   UID   TIME COMMAND
32714   725   725 32714 pts/11   32714 S        0   0:00 ssh -o
ControlMaster=no -o ControlPath=/tmp/socket.tmp 127.0.0.1 sleep 9999
  579 32714 32714 32714 pts/11   32714 Ss+      0   0:00 bash
$

If I kill the "ssh -o ControlMaster=no -o ControlPath=/tmp/socket.tmp
127.0.0.1 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.

Idea?

-clark


reply via email to

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