简体   繁体   English

获取 stty:标准输入:通过 ssh 隧道使用 scp 时设备的 ioctl 不合适

[英]Getting stty: standard input: Inappropriate ioctl for device when using scp through an ssh tunnel

Per the title, I'm getting the following warning when I try to scp through an ssh tunnel.根据标题,当我尝试通过ssh隧道scp时,我收到以下警告。 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).就我而言,我无法直接scp到 foo,因为设备 foo 上的端口 1234 被转发到专用网络上的另一台机器 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

Does anyone know why I might be getting this warning about Inappropriate ioctl for device ?有谁知道为什么我可能会收到有关Inappropriate ioctl for device警告?

I got the exact same problem when I included the following line on my ~/.bashrc :当我在~/.bashrc包含以下行时,我遇到了完全相同的问题:

stty -ixon

The purpose of this line was to allow the use of Ctrl-s in reverse search of bash .此行的目的是允许在bash 的反向搜索中使用Ctrl-s

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. 'stty' 适用于交互式登录会话的 ttys。 .kshrc is executed for all sessions, including ones where stdin isn't a tty. .kshrc 为所有会话执行,包括 stdin 不是 tty 的会话。 The solution, other than moving it to your .profile, is to make execution conditional on it being an interactive shell.除了将其移动到您的 .profile 之外,解决方案是使其执行以交互式 shell 为条件。

There are several ways to check for interecative shell . 有几种方法可以检查交互性 shell The following solves the problem for bash:以下解决了bash的问题:

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

Got the same issue while executing the script remotely.远程执行脚本时遇到同样的问题。 After many tries didn't get any luck to solve this error.经过多次尝试,没有任何运气来解决这个错误。 Then got an article to run a shell script through ssh.然后得到了一篇通过ssh运行shell脚本的文章 This was an issue related to ssh, not any other command.这是一个与 ssh 相关的问题,而不是任何其他命令。 ssh -t "command" -t will allocate a pseudo TTY to the ssh and this error won't come. ssh -t "command" -t 将为ssh -t "command"分配一个伪 TTY,并且不会出现此错误。

at the end i created a blank .cshrc file ( for ubuntu 18.04).最后我创建了一个空白的 .cshrc 文件(适用于 ubuntu 18.04)。 worked工作过

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM