开始使用:标准输入:通过ssh隧道使用scp时,设备的ioctl不适当 [英] Getting stty: standard input: Inappropriate ioctl for device when using scp through an ssh tunnel

查看:792
本文介绍了开始使用:标准输入:通过ssh隧道使用scp时,设备的ioctl不适当的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每个标题,当我尝试通过ssh隧道scp时,都会收到以下警告.就我而言,我不能直接scp到foo,因为设备foo上的端口1234被转发到专用网络上的另一台机器吧(而bar是向我提供通往192.168.1.23隧道的机器).

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

有人知道为什么我可能会收到有关Inappropriate ioctl for device的警告吗?

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

推荐答案

当我在~/bashrc上包含以下行时,我遇到了完全相同的问题:

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

stty -ixon

此行的目的是允许在反向搜索bash中使用 Ctrl-s .

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

此链接提供了解决方案(不可用)

以上链接的Web存档版本

'stty'适用于用于交互式登录会话的ttys. .kshrc对所有会话都执行,包括那些没有stdin的会话 一个tty.除了将其移动到您的.profile之外,解决方案是 以交互外壳为条件,使执行成为条件.

'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.

有几种方法可以检查互动壳.以下解决了bash的问题:

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

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

这篇关于开始使用:标准输入:通过ssh隧道使用scp时,设备的ioctl不适当的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆