解决xterm显示远程窗口出现“Can't open display: localhost:11.0”的问题

2023-05-16

参考:http://unix.stackexchange.com/questions/117159/cannot-start-xterm-over-ssh-after-several-successes

问题描述:

远程调用gnuplot,

> plot 'out.txt' using 1:2。

出现,

>Error: Can't open display: localhost:11.0。

时好时坏——偶尔能显示,过会儿又不能显示。问题很难定位。

解决方法:

1 使用 ssh -Y 代替 ssh -X


2 在 ~/.ssh/config 中添加 ForwardX11Trusted yes


原文:

SSH blocks new X11 connections after 20 minutes in its default setup. To avoid this, run ssh -Y instead of ssh -X, or set the option ForwardX11Trusted yes in ~/.ssh/config.

If you run ssh -v, you'll see the message “Rejected X11 connection after ForwardX11Timeout expired” when a new application tries to connect to the display after the timeout. Without -v (which causes a lot of other debugging output), all the information you get is “Can't open display”.

————————————————————————————————————————————————————

To explain why, I need to give a little background. X11 forwarding allows the destination machine to contact the local X server. This has consequences in terms of security. An X11 server does not isolate applications from each other; this allows the window manager to move windows around and kills them as it wishes, it allows macro processing tools to do that as well and inject keystrokes and so on. Also any application can read and modify the clipboard. This gives a lot of power to remote applications over your local data. If the remote machine is untrusted, with a text mode connection, the worst that can happen is bad stuff on the remote machine. But with an unfettered X11 connection, bad stuff can happen on your local machine too.

X11 includes the “SECURITY extension”, which allows some applications to be declared as untrusted. Untrusted applications get fewer rights, for example they cannot monitor or inject keystrokes in other applications. SSH gives the option of declaring the connection to be trusted (ForwardX11Trusted yes or ssh -Y) or untrusted (ForwardX11Trusted no or ssh -X).

SSH has long defaulted to establishing untrusted connections. As an additional safety feature, untrusted connections can only be established for a few minutes at the beginning of the SSH session; originally 2 minutes (ssh.c 1.202), then 20 minutes (ssh.c 1.207). As a safety feature, I don't see the point: if you're running an untrusted application already, whether another application can be launched later is moot. Recent versions of SSH (ssh.c 1.340, clientloop.c 1.221) have made the timeout configurable with the ForwardX11Timeout.

Unfortunately, due to a bug in X.org (not public at this time), you cannot set an overly large value of ForwardX11Timeout, or else the X server will crash.

Trusted connections are not subject to this expiration mechanism. The trade-off is that malware or a malicious administrator on the remote machine can take control of your local machine. This is often acceptable, but it's up to you to decide.


本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

解决xterm显示远程窗口出现“Can't open display: localhost:11.0”的问题 的相关文章

随机推荐

  • Linux学习笔记四-Shell中[],(())

    的使用 的返回值 xff1a 0 代表真1 代表假 中可用的比较运算符只有 61 61 和 61 xff0c 两者都是用于字符串比较的 xff0c 不可用于整数比较 xff0c 整数比较只能使用 eq xff0c gt这种形式 无论是字符串
  • Java集合源码学习(一)集合框架

    原文地址 xff1a https yq aliyun com articles 38397 spm 61 5176 8091938 0 0 fRUCzz 集合框架 Java集合框架包含了大部分Java开发中用到的数据结构 xff0c 主要包
  • Java集合源码学习(二)ArrayList分析

    原文地址 xff1a https yq aliyun com articles 38407 spm 61 5176 8091938 0 0 3G9cay 关于ArrayList ArrayList直接继承AbstractList xff0c
  • Java集合源码学习(三)LinkedList分析

    原文地址 xff1a https yq aliyun com articles 38408 spm 61 5176 8091938 0 0 tjeCwH 前言 前面学习了ArrayList的源码 xff0c 数组是顺序存储结构 xff0c
  • Java集合源码学习(四)HashMap分析

    原文地址 xff1a https yq aliyun com articles 38410 spm 61 5176 8091938 0 0 01LA3v 摘要 ArrayList LinkedList和HashMap的源码是一起看的 xff
  • Java类的加载顺序及生命周期原理解析

    摘要 经常看到java面试题static 构造函数等混合执行 问会输出什么 xff0c 这里针对类的加载及类的生命周期进行原理的解析 xff0c 就能很快明白了 java类的加载顺序 简单的说 xff0c 首先要知道Java虚拟机对clas
  • 牛客网-贪心-裁减网格纸

    https www nowcoder com questionTerminal 65865c6644154bb4acca764b1480ecbb orderByHotValue 61 1 amp questionTypes 61 00010
  • 牛客网-贪心-最大间隔

    https www nowcoder com questionTerminal 3a571cdc72264d76820396770a151f90 orderByHotValue 61 1 amp questionTypes 61 00010
  • Ubuntu 执行属性为executable (application/x-executable)的文件

    ubuntu14 04 LTS下执行属性为executable application x executable 的文件的方法 xff1a 1 chmod 43 x filename 2 filename 就可以执行了 xff01 xff0
  • 牛客网-贪心-扫描透镜

    https www nowcoder com questionTerminal 6a219d196df44d3abd82fbadb1a62c3f orderByHotValue 61 1 amp questionTypes 61 00010
  • TCP三次握手与四次握手

    HTTP工作流程 当我们从浏览器输入一个url xff0c Http的工作流程如下图所示 xff1a DNS解析流程请看DNS域名解析过程这篇文章 现在来讲TCP三次握手 TCP三次握手 什么是TCP TCP是主机对主机层的传输控制协议 x
  • JAVA题目汇总

    什么是Java虚拟机 xff1f 为什么Java被称作是 平台无关的编程语言 xff1f Java虚拟机是一个可以执行Java字节码的虚拟机进程 Java源文件被编译成能被Java虚拟机执行的字节码文件 Java被设计成允许应用程序可以运行
  • 二维数组中的查找

    时间限制 xff1a 1秒 空间限制 xff1a 32768K 热度指数 xff1a 343751 本题知识点 xff1a 查找 算法知识视频讲解 题目描述 在一个二维数组中 xff0c 每一行都按照从左到右递增的顺序排序 xff0c 每一
  • 替换空格

    时间限制 xff1a 1秒 空间限制 xff1a 32768K 热度指数 xff1a 307877 本题知识点 xff1a 字符串 算法知识视频讲解 题目描述 请实现一个函数 xff0c 将一个字符串中的空格替换成 20 例如 xff0c
  • 从尾到头打印链表(链表反转)

    时间限制 xff1a 1秒 空间限制 xff1a 32768K 热度指数 xff1a 265674 本题知识点 xff1a 链表 算法知识视频讲解 题目描述 输入一个链表 xff0c 从尾到头打印链表每个节点的值 笔记收藏纠错 span c
  • 重建二叉树

    时间限制 xff1a 1秒 空间限制 xff1a 32768K 热度指数 xff1a 177198 算法知识视频讲解 题目描述 输入某二叉树的前序遍历和中序遍历的结果 xff0c 请重建出该二叉树 假设输入的前序遍历和中序遍历的结果中都不含
  • 用两个栈实现队列

    时间限制 xff1a 1秒 空间限制 xff1a 32768K 热度指数 xff1a 118150 本题知识点 xff1a 队列 栈 算法知识视频讲解 题目描述 用两个栈来实现一个队列 xff0c 完成队列的Push和Pop操作 队列中的元
  • 旋转数组的最小数字

    时间限制 xff1a 3秒 空间限制 xff1a 32768K 热度指数 xff1a 162501 本题知识点 xff1a 查找 算法知识视频讲解 题目描述 把一个数组最开始的若干个元素搬到数组的末尾 xff0c 我们称之为数组的旋转 输入
  • 变态的台阶

    时间限制 xff1a 1秒 空间限制 xff1a 32768K 热度指数 xff1a 98625 算法知识视频讲解 题目描述 一只青蛙一次可以跳上1级台阶 xff0c 也可以跳上2级 它也可以跳上n级 求该青蛙跳上一个n级的台阶总共有多少种
  • 解决xterm显示远程窗口出现“Can't open display: localhost:11.0”的问题

    参考 xff1a http unix stackexchange com questions 117159 cannot start xterm over ssh after several successes 问题描述 xff1a 远程调