linux - 获取 stty : standard input: Inappropriate ioctl for device when using scp through an ssh tunnel

标签 linux ssh scp

根据标题,当我尝试通过 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/

相关文章:

linux - 编译自定义 FFMPEG 以将 mp3/wav 转换为 flac

c - 是否有 linux (gcc) 上使用的所有用户数据结构的引用

linux - bash:静默杀死后台函数进程

linux - 带有生成文件 : add a sound at the end of build 的 CMake

python - 从 pexpect sendline 读取输出

bash - 使用 scp 将文件从一台服务器复制到另一台服务器时发送密码

linux - 使用通配符的 scp 文件。目标包含通配符的结果

deployment - 权限拒绝了 Cap 的公钥,但我可以 ssh 进入 github

php - 如何通过ssh远程运行MySQL脚本文件?

c - 谁必须负责以下 scp 示例中的通配符处理?