不能使用xterm

shell> su - mysql

shell> xterm

Xlib: connection to ":0.0" refused by server

Xlib: No protocol specified

xterm Xt error: Can't open display :0.0

这个问题该如何解决呢?

1.用root登陆
2.执行xhost +
3.su - mysql

现在就可以执行xterm了;

以下是man xhost的部分解释:

The  xhost  program  is  used  to add and delete host names or user names to the list allowed to make connections to the X
       server.  In the case of hosts, this provides a rudimentary form. of privacy control and security.  It  is  only  sufficient
       for  a  workstation  (single  user) environment, although it does limit the worst abuses.  Environments which require more
       sophisticated measures should implement the user-based mechanism or use the  hooks  in  the  protocol  for  passing  other
       authentication data to the server.

以下信息摘抄自别人blog, 并没有全部验证,

xhost + 是使所有用户都能访问Xserver.
xhost + ip使ip上的用户能够访问Xserver.
xhost + nis:user@domain使domain上的nis用户user能够访问
xhost + inet:user@domain使domain上的inet用户能够访问。

上面的操作在本机挺好的;

但是如果想要访问远程机器的xterm, 那么就有些麻烦了;

1) ssh -X root@remote_server_ip; 这里-X一定需要,什么作用,去查ssh --help

2) 在当前用户下, 需要有.Xauthority文件,并且这个文件的owner:group需要是自己;

知道了觉得也不难, 不知道的时候觉得非常痛苦..

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/7682812/viewspace-668366/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/7682812/viewspace-668366/

根据引用和引用,您在连接Ubuntu 20.04时遇到了问题。具体错误是"Network error: Connection refused"。同时,您在使用mobaXterm时也遇到了问题,具体是打开rviz时出现了段错误(Segmentation fault)。 根据引用,可能的原因是wsl无法连接到mobaXterm的X服务器。为了解决这个问题,您可以尝试在mobaXterm的设置中进入X11选项,然后将"X11 remote access"设置为"full"。这样可以确保wsl能够连接到mobaXterm的X服务器并正确显示可视化界面。 希望这些信息对您有帮助!<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [ubuntu20.04配置ssh,使用MobaXterm远程连接](https://blog.csdn.net/sun1221__/article/details/121516849)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"] - *2* *3* [win11+wsl+ubuntu20.04+ros+x11+mobaxterm实现win11中ROS使用(含可视化)](https://blog.csdn.net/qq_43326927/article/details/130663899)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值