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

摘要:
1)X11有两个部分组成,一个是Xserver,一个是Xclient;--运行在Mac上的是Xserver,Xserver主要负责显示用户界面,管理显示器以及鼠标和键盘,把相关的动作告诉Xclient,通常比较多的Xserver是:windows的Xming和MobaXterm,MAC有Xquartz,以及其他各种Xserver的应用。在OpenSSH的配置文件中,打开如下两项:1AllowTcpForwardingyes2X11Forwardingyes在Ubuntu桌面下,对OpenSSH-Client的配置文件修改,打开如下三项:1ForwardAgentyes2ForwardX11yes3ForwardX11Trustedyes4)典型的Xclient:xeyesxclockfirefox等等6)动手操作:1.ssh-Xuser@remote-server2.ssh-Yuser@remote-server3.ssh-YC4user@remote-server可以参考:为什么Firefox在SSH上这么慢?

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的协议

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

X11 Forwarding实现

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

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,直接下载安装即可:Visitthis page and downloadXQuarz 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 toinstall Homebrew on macOSto 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的ssh远程打开linux的firefox(通过X11协议实现图形化显示)》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇xtrabackup 源码安装Django Restful Framework下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

linux应用层监控网线插拔状态的实现

1、对于基于linux2.4内核的uclinux系统如何实现在应用层监控网线插拔状态? 2、硬件环境:IPS100(ARM7TDMI) 3、实现过程 由于linux下的ifconfig命令就能够实现在应用层监控网线插拔状态,例如当网线连接正常时,使用ifconfig eth0命令,打印的信息中会有RUNNING,而拔掉网线后,再使用ifconfig et...

linux路由表配置

一、原理说明 1、路由表(table)从0到255进行编号,每个编号可以对应一个别名,编号和别名的对应关系在linux下放在/etc/iproute2/rt_tables这个文件里,一般0编号的table对应的别名为upspec,255编号对应的别名为local,254和253对应的别名分别为main和default,我们通常用route命令配置和查看的...

在linux中使用ramdisk文件系统 天高地厚

一 什么是RamDisk Ram:内存,Disk:磁盘,在Linux中可以将一部分内存当作分区来使用,称之为RamDisk。对于一些经常被访问、并且不会被更改的文件,可以将它们通过RamDisk放在内存中,能够明显地提高系统性能。RamDisk工作于虚拟文件系统(VFS)层,不能格式化,但可以创建多个RamDisk。虽然现在硬盘价钱越来越便宜,但对于一些...

Android Native C 之 Helloworld的四种编译方式_转载

一.编写helloworld.c Android.mk     [root@fontlose jni]# cat hello.c  [cpp] view plaincopyprint?  #include <stdio.h>   int main()   {       printf("Hello World!\n");       ...

linux文本处理常用指令(序列二)

概览 本文主体:介绍4个linux文本处理命令:grep、sed、printf、awk。 基本正则表达式 正则表达式字符 含义 ^word 查找以word开头的文本 word$ 查找以word结尾的文本 . 代表一个任意字符 转义符 * 0到多个字符 [abc] 代表一个字符,这个字符是a或b或c [a-z];[0-9]...

Linux下Oracle设置环境变量

2013-02-19   linux下oracle设置环境变量   需要设置ORACLE_HOME和ORACLE_SID两个环境变量,再把ORACLE的bin目录添加到PATH中即可,   通常缺省安装的情况下ORACLE_SID=orcl,ORACLE_HOME=/home/oracle/oracle/product/10……这样的形式,   操作步骤...