ICode9

精准搜索请尝试: 精确搜索
首页 > 系统相关> 文章详细

通过MacOS的ssh远程打开linux的firefox(通过X11协议实现图形化显示)

2021-09-23 13:05:52  阅读:695  来源: 互联网

标签:MacOS firefox Xserver www server ssh https X11 图形化


1)X11有两个部分组成,一个是X server,一个是X client;

  --运行在Mac上的是X server,Xserver主要负责显示用户界面,管理显示器以及鼠标和键盘,把相关的动作告诉X client,通常比较多的Xserver是:windows的Xming和MobaXterm,MAC有Xquartz,以及其他各种Xserver的应用。

  --运行在远端机器上的是X client,X client负责程序逻辑,X client根据程序预先设定的逻辑,告诉X server ,请在这了点击鼠标,同时也就是sshd,ssh server的机器;

2)X11的协议

X11 Forwarding实现

 

3)X11实现,大部分情况下Xserver和Xclient在同一台机器上,看起来没有什么,但是X server和Xclient完全可以运行在不同的机器上,只要彼此通过X协议通信即可。我们可以通SSH的X11 forwarding转发实现,远程机器运行GUI程序(Xclient),在本地显示(X server)

 

 


 

关于如何在Mac操作系统上实现X11的 Xserver展示远端linux或者其他机器上的Xclient应用程序,具体可以参考如下链接:https://www.cyberciti.biz/faq/apple-osx-mountain-lion-mavericks-install-xquartz-server/ 具体的过程可以大致分成几个部分:

1. 需要安装X server,我们通常可以通过安装XQuartz来实现,

  方法1,直接下载安装即可:Visit this page and download XQuarz server for macOS. Once downloaded the XQuarz package, install the server by double clicking the package icon in your Downloads folder. Please follow the instructions on-screen to complete the installations:

  方法2:通过brew install --cask xquartz来实现:Another option is to install Homebrew on macOS to use the brew package manager as follows using the Termaial app:

2. 安装完成之后,请重启电脑

3. 关于server端的sshd和本地的ssh config的配置文件如何配置,可以参考:https://www.jianshu.com/p/24663f3491fa

 远程的sshd配置:

你需要在你的远程CentOS主机上配置OpenSSH服务,启用X11 Forwarding。在OpenSSH的配置文件中(/etc/ssh/sshd_config),打开如下两项:

1 AllowTcpForwarding yes
2 X11Forwarding yes

 

 

在Ubuntu桌面下,对OpenSSH-Client的配置文件(/etc/ssh/ssh_config)修改,打开如下三项:

1 ForwardAgent yes
2 ForwardX11 yes
3 ForwardX11Trusted yes

 

4)典型的Xclient:

  xeyes xclock firefox 等等

 

6)动手操作:

 

 

 

1. ssh -X user@remote-server 

2. ssh -Y user@remote-server

3. ssh -YC4 user@remote-server

可以参考:为什么Firefox在SSH上这么慢?

最佳答案

默认的ssh设置会导致连接速度很慢。请尝试以下方法:

ssh -YC4c arcfour,blowfish-cbc user@hostname firefox -no-remote

使用的选项是:

-Y      Enables trusted X11 forwarding.  Trusted X11 forwardings are not
         subjected to the X11 SECURITY extension controls.
 -C      Requests compression of all data (including stdin, stdout,
         stderr, and data for forwarded X11 and TCP connections).  The
         compression algorithm is the same used by gzip(1), and the
         “level” can be controlled by the CompressionLevel option for pro‐
         tocol version 1.  Compression is desirable on modem lines and
         other slow connections, but will only slow down things on fast
         networks.  The default value can be set on a host-by-host basis
         in the configuration files; see the Compression option.
 -4      Forces ssh to use IPv4 addresses only.
 -c cipher_spec
         Selects the cipher specification for encrypting the session.

         For protocol version 2, cipher_spec is a comma-separated list of
         ciphers listed in order of preference.  See the Ciphers keyword
         in ssh_config(5) for more information.

这里的要点是使用不同的加密密码,在这种情况下,arcfour比默认值更快,并压缩正在传输的数据。

 


 

参考链接:

 

标签:MacOS,firefox,Xserver,www,server,ssh,https,X11,图形化
来源: https://www.cnblogs.com/zafu/p/15323704.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有