Getting stty: standard input: Inappropriate ioctl

2019-02-05 17:48发布

问题:

Per the title, I'm getting the following warning when I try to scp through an ssh tunnel. In my case, I cannot scp directly to foo because port 1234 on device foo is being forwarded to another machine bar on a private network (and bar is the machine that is giving me a tunnel to 192.168.1.23).

$ # -f and -N don't matter and are only to run this example in one terminal
$ ssh -f -N -p 1234 userA@foo -L3333:192.168.1.23:22
$ scp -P 3333 foo.py ubuntu@localhost:
ubuntu@localhost's password:
stty: standard input: Inappropriate ioctl for device
foo.py                                          100% 1829     1.8KB/s   00:00

Does anyone know why I might be getting this warning about Inappropriate ioctl for device?

回答1:

I got the exact same problem when I included the following line on my ~/bashrc:

stty -ixon

The purpose of this line was to allow the use of Ctrl-s in reverse search of bash.

This link has a solution (not available)

Web Archive version of the above link

'stty' applies to ttys, which you have for interactive login sessions. .kshrc is executed for all sessions, including ones where stdin isn't a tty. The solution, other than moving it to your .profile, is to make execution conditional on it being an interactive shell.

There are several ways to check for interecative shell. The following solves the problem for bash:

[[ $- == *i* ]] && stty -ixon


标签: linux ssh scp