根据标题,当我尝试通过 ssh
隧道进行 scp
时收到以下警告。在我的例子中,我不能 scp
直接到 foo 因为设备 foo 上的端口 1234 被转发到私有(private)网络上的另一台机器 bar(而 bar 是给我一条通往 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
有谁知道为什么我会收到关于Inappropriate ioctl for device
的警告?
最佳答案
当我在 ~/.bashrc
中包含以下行时,我遇到了完全相同的问题:
stty -ixon
此行的目的是允许使用 Ctrl-s in reverse search of bash .
这个 gmane 链接有一个解决方案:(original link dead) => Web Archive version of gmane 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 .以下解决了 bash 的问题:
[[ $- == *i* ]] && stty -ixon
关于linux - 获取 stty : standard input: Inappropriate ioctl for device when using scp through an ssh tunnel,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24623021/