在命令行参数中使用SSH启动远程服务器上的firefox

有没有办法使用SSH这种方式启动远程服务器上的Firefox? :

ssh username@ip_address [command line] 

当我运行: ssh username@ip_address -Y (or -X) firefox (我想从远程-Ubuntu桌面上本地-Ubuntu服务器上启动firefox ),我得到这个错误: Error: no display specified

重要说明 :我想从Ubuntu服务器到Ubuntu桌面操作系统运行这个命令。

您可以使用X转发来做到这一点。 确保你的服务器上安装了firefox,然后从桌面上运行:

 ssh username@ip_adress -Y [command line] 

如果-Y不起作用,您仍然可以使用-X。

如果不工作,请确保:

  • 在服务器上的/etc/ssh/sshd_configX11Forwarding设置为yes
  • 在客户端的/etc/ssh/ssh_configForwardX11设置为yes 。 如果需要添加行。
  • 在服务器上sudo apt-get install xauthsudo apt-get install xauth

问候,

托马斯。

这应该让你滚动:

 ssh machine DISPLAY=0:0 firefox 

只是用两台Ubuntu机器试了一下。

语法FOO=asdf BAR=fdsa command arg arg2对于SSH来说并不特别,只是为command设置环境variables。 您需要告诉Firefox X11显示器在哪里 – 在这种情况下,它是与Firefox相同的机器。 不使用X11转发,因为Firefox和X11服务器都在同一个盒子里。

另见https://superuser.com/questions/368530/understanding-x-windows-display-environment-variable-when-tunnelling