Mac OSX Mavericks X11“连接被拒绝”

xxj*_*jnn 5 x11-forwarding osx-mavericks

概括

当我在该 macbook 上的 Ubuntu 虚拟机中时,我可以从我的 macbook SSH 到远程 Linux 机器 - 但不能从 OSX。我寻求有关如何让 OSX 与 X11 转发一起工作的指导,并怀疑这是 OSX Mavericks 问题。在我升级之前它曾经在 Mountain Lion 上工作,所以我想我错过了一步。

请注意,这不是升级到 OS X Mavericks 后 X11/XQuartz 不会自动启动?正如我对 Mavericks 进行格式化和全新安装一样

X11 服务器 - Ubuntu 桌面

# This is the /etc/ssh/sshd_config file, trimmed down

# Relevant lines:
X11Forwarding yes
X11UseLocalhost yes
X11DisplayOffset 10

# Maybe relevant:
RSAAuthentication no
PubkeyAuthentication yes
AuthorizedKeysFile  %h/.ssh/authorized_keys
PasswordAuthentication yes # I didn't want to copy the rsa key into ubuntu VM so I accessed the server by password authentication rather than by rsa key.
TCPKeepAlive yes
Run Code Online (Sandbox Code Playgroud)

我可以 ssh 进入这台机器没有问题。

X11 客户端 - OSX Mavericks(不工作)

我安装了XQuartz 2.7.5,不确定我在 OSX Mountain Lion 上安装的是哪个版本。

# edited /etc/ssh_config to prevent timeout issues

ForwardX11Timeout 596h
Run Code Online (Sandbox Code Playgroud)

在 .ssh/config 文件中我有

Host remotegossamer
  User joe
  port 22
  Hostname 55.55.55.55 # (edited.. I use no-ip as I have a dynamic ip)
  ForwardX11 yes
  ForwardX11Trusted yes # This gets rid of the warning: "Warning: untrusted X11 forwarding setup failed: xauth key data not generated"
Run Code Online (Sandbox Code Playgroud)

当我 ssh 进入时,我收到警告

> ssh remotegossamer
Warning: No xauth data; using fake authentication data for X11 forwarding.
Welcome to Ubuntu 13.10 (GNU/Linux 3.11.0-15-generic x86_64)
...
Run Code Online (Sandbox Code Playgroud)

当我尝试打开 X11 窗口时失败

joe@gossammer:~$ firefox&
[1] 12195
joe@gossammer:~$ connect 127.0.0.1 port 6010: Connection refused

(process:12195): GLib-CRITICAL **: g_slice_set_config: assertion 'sys_page_size == 0' failed
connect 127.0.0.1 port 6010: Connection refused
connect 127.0.0.1 port 6010: Connection refused
Error: cannot open display: localhost:10.0
^C
[1]+  Exit 1                  firefox
Run Code Online (Sandbox Code Playgroud)

Glib-CRITICAL 是 ubuntu 和 osx 客户端都存在的 firefox 错误,它是服务器的问题,可以忽略。

的结果echo $DISPLAYlocalhost:10.0localhost:11.0取决于我是首先还是第二次使用当前机器进行 ssh 连接。断开两台机器的连接并以相反的顺序 sshing in 没有效果;ubuntu 客户端在 10 和 11 上成功,OSX 在两者上都失败了。

我读到了这一点,端口 6010 是正确的,因为它从端口 6000 开始并以 10 的增量递增,如服务器的 sshd_config 中所述。

所以我很困惑为什么 OSX 没有连接......

我应该注意,当我以前从 Mountain Lion ssh 进入时,XQuartz 应用程序会启动 - 现在它不会

X11 客户端 - Ubuntu 桌面(在 OSX Mavericks 上的虚拟机中)

将 ubuntu 虚拟机配置为通过 ssh 连接到服务器:

# I edited the /etc/ssh/ssh_config to have:
Host *
    ForwardAgent yes
    ForwardX11 yes
    ForwardX11Trusted yes
Run Code Online (Sandbox Code Playgroud)

然后我加入了:

ssh -Y joe@55.55.55.55
Run Code Online (Sandbox Code Playgroud)

并没有收到任何警告。然后,我做了:

> firefox&
Run Code Online (Sandbox Code Playgroud)

它在 X11 中打开,很好,所以它是 OSX 的问题/我设置 OSX 的方式

所以

在 OSX Mavericks 上设置 X11 时我错过了什么吗?

Mar*_*iae 5

尝试以下命令(一旦您登录到 OS X):

export XAUTHORITY=/home/your_name/.Xauthority
Run Code Online (Sandbox Code Playgroud)

然后尝试一些无害的 X 应用程序,例如xeyes. 如果它有效,您可以将该语句放入您的.bashrc文件中。