AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / ubuntu / 问题 / 3515
Accepted
Lesmana
Lesmana
Asked: 2010-09-03 19:56:44 +0800 CST2010-09-03 19:56:44 +0800 CST 2010-09-03 19:56:44 +0800 CST

如何通过 SSH 启动远程 Firefox 窗口?

  • 772

当我通过 SSH 连接到远程机器时

$ ssh -X remotebox

然后在远程盒子上启动 Firefox

remotebox$ firefox

我在本地机器上运行了 Firefox,本地 Firefox 窗口将打开。远程盒子上没有运行 Firefox 进程。

如果我的本地机器上没有运行 Firefox,那么将打开一个远程 Firefox 窗口。

为什么它会打开本地 Firefox 窗口?我怎样才能防止这种情况?


这里有一些关于我的本地系统的更多信息。

Linux lesmana-laptop 2.6.32-24-generic #42-Ubuntu SMP Fri Aug 20 14:24:04 UTC 2010 i686 GNU/Linux

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 10.04.1 LTS
Release:    10.04
Codename:   lucid

DISPLAY=:0.0

Mozilla Firefox 3.6.8, Copyright (c) 1998 - 2010 mozilla.org

遥控器信息。

Linux dxray 2.6.22.19-0.4-default #1 SMP 2009-08-14 02:09:16 +0200 x86_64 x86_64 x86_64 GNU/Linux

LSB Version:    core-2.0-noarch:core-3.0-noarch:core-2.0-x86_64:core-3.0-x86_64:desktop-3.1-amd64:desktop-3.1-noarch:graphics-2.0-amd64:graphics-2.0-noarch:graphics-3.1-amd64:graphics-3.1-noarch
Distributor ID: SUSE LINUX
Description:    openSUSE 10.3 (X86-64)
Release:    10.3
Codename:   n/a

DISPLAY=localhost:15.0

Mozilla Firefox 3.0.14, Copyright (c) 1998 - 2009 mozilla.org

以下命令使用远程 firefox 窗口启动远程 firefox 会话。

remotebox$ firefox -no-remote

以下命令会产生短暂的延迟,然后返回提示符并弹出一个本地 firefox 窗口。remotebox 上没有运行 firefox 进程。

remotebox$ firefox

remotebox2 的信息。

Linux marvin 2.6.31-22-generic #60-Ubuntu SMP Thu May 27 00:22:23 UTC 2010 i686 GNU/Linux

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 9.10
Release:    9.10
Codename:   karmic

DISPLAY=localhost:11.0

Mozilla Firefox 3.6.8, Copyright (c) 1998 - 2010 mozilla.org

remotebox2 上的以下命令按预期启动远程 Firefox 会话。

remotebox2$ firefox

我不知道为什么 remotebox2 上的 firefox 会启动远程会话而不是本地会话。

ssh firefox
  • 7 7 个回答
  • 202913 Views

7 个回答

  • Voted
  1. Best Answer
    mkm
    2010-09-04T07:40:53+08:002010-09-04T07:40:53+08:00

    除了firefox -no-remote 另一个参数,firefox -no-xshm它揭示了用于使其工作的技术。

    X11 共享内存是一种进程间通信技术,可以被连接到给定 x 服务器会话的所有应用程序使用。它可用于执行拖放和其他类型的桌面交互。

    它也可以(并且现在)用于实现“打开一次”应用程序,以减少占用空间(或窗口数量)。

    由于 X11 协议是网络透明的,“共享内存”也扩展到远程 X11 客户端。

    • 54
  2. Dennis Williamson
    2010-09-03T20:48:24+08:002010-09-03T20:48:24+08:00

    尝试firefox -no-remote

    • 19
  3. user2577
    2010-10-01T05:31:02+08:002010-10-01T05:31:02+08:00

    注意,我做了圆顶挖掘,因为这让我很烦,你也可以添加:

    MOZ_NO_REMOTE=1
    export MOZ_NO_REMOTE
    

    到您的个人资料。

    • 12
  4. josip b
    2015-10-12T08:58:27+08:002015-10-12T08:58:27+08:00

    你可以试试这个,当你连接到机器时(ssh user@host; 注意:没有 -X 选项),首先输入以下命令

    export DISPLAY=:0 
    

    这会将默认显示更改为当前桌面屏幕的显示。然后只需键入

    firefox
    

    在桌面窗口上生成 Firefox。确保您已登录桌面,否则(没有登录)您将收到以下错误;

    firefox: cannot connect to X server :0
    

    此方法也适用于锁定的桌面。请确保您已使用相同的用户名登录桌面和 ssh shell。

    当有多个桌面会话时,每个会话由不同的数字标识,如:0、:1、:2等。

    • 4
  5. Richard Gomes
    2018-05-16T17:19:31+08:002018-05-16T17:19:31+08:00

    简单的远程浏览

    如果您想像坐在远程盒子前一样在本地浏览网页:

    $ ssh -X [email protected]
    

    然后在远程终端会话中运行 Firefox :

    $ firefox https://test-ipv6.com/
    

    注意命令中-X标志的用法。ssh您也可以一次完成这两个步骤,如下所示:

    $ ssh -X [email protected] firefox http://test-ipv6.com/
    

    隧道远程IP:端口

    如果你有一个远程运行的应用程序暴露了某种 web 前端,你会对暴露远程 IP:port 感兴趣,就好像它是一个本地 IP:port。在这种情况下,该-L选项定义了 和 之间的对应关系localhost:localport,remotehost:remoteport如下面的伪命令所示:

    ssh -L localhost:localport:remotehost:remoteport remoteuser@remotehost
    

    例如:

    $ ssh -L 127.0.0.1:18080:internal.example.com:8080 [email protected]
    

    然后在本地运行 Firefox :

    $ firefox http://127.0.0.1:18080
    

    在上面的示例中,您通过 SSH 连接到[email protected],并且您对暴露在 的 Web 前端感兴趣internal.example.com:8080。此远程 IP:port 将在本地公开127.0.0.1:18080。

    • 4
  6. verayth
    2017-01-25T13:51:36+08:002017-01-25T13:51:36+08:00

    其他解决方案都不适合我,所以这是在其他网站上进行了一些搜索之后。

    您需要在单独的进程中运行 Firefox,就像在本地计算机上执行所有操作一样。使用配置文件管理器创建一个新配置文件,如下所示。

    export MOZ_NO_REMOTE=1
    firefox -ProfileManager
    

    为了保持一致,我决定将外部机器上的每个新配置文件命名为与主机名相同。

    • 2
  7. oczkoisse
    2017-03-27T11:38:35+08:002017-03-27T11:38:35+08:00

    我只会添加对我有用的东西。简单地使用firefox -no-remote失败并出现通常的错误

    Error: GDK_BACKEND does not match available displays
    

    但是,以下工作:

    ssh -Y user@host
    firefox -no-remote
    

    该-Y选项启用受信任的 X11 转发。受信任的 X11 转发不受 X11 SECURITY 扩展控制的约束。您也可以考虑在命令中添加-C选项以ssh启用压缩。

    • 1

相关问题

  • Firefox 鼠标中键滚动

  • 如何解决 Firefox 中的字体问题?

  • 使用突触或通过 Firefox 的插件菜单安装 adblock?

  • Firefox 的 Ubuntu Firefox 修改扩展有什么作用?

  • 如何与无头服务器进行图形交互?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何安装 .run 文件?

    • 7 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    如何获得 CPU 温度?

    • 21 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Marko Smith

    如何使用命令行将用户添加为新的 sudoer?

    • 7 个回答
  • Marko Smith

    更改文件夹权限和所有权

    • 9 个回答
  • Marko Smith

    你如何重新启动Apache?

    • 13 个回答
  • Marko Smith

    如何卸载软件?

    • 11 个回答
  • Marko Smith

    如何删除 PPA?

    • 26 个回答
  • Martin Hope
    NES 如何启用或禁用服务? 2010-12-30 13:03:32 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    Olivier Lalonde 如何在结束 ssh 会话后保持进程运行? 2010-10-22 04:09:13 +0800 CST
  • Martin Hope
    David B 如何使用命令行将用户添加为新的 sudoer? 2010-10-16 04:02:45 +0800 CST
  • Martin Hope
    Hans 如何删除旧内核版本以清理启动菜单? 2010-08-21 19:37:01 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve