Mountain Lion SSH -X问题


8

如何通过SSH在Mountain Lion X11转发上运行?

例:

ssh -X some@example.com xterm

我的/ etc / sshd_config有

X11Forwarding yes
#X11DisplayOffset 10
X11UseLocalhost yes

# XAuthLocation added by XQuartz (http://xquartz.macosforge.org)
XAuthLocation /opt/X11/bin/xauth

重新启动sshd

launchctl stop com.openssh.sshd
launchctl start com.openssh.sshd

(以及从首选项->共享)

启动XQuatrz,然后从xterm运行

ssh -v -X mrp@192.168.1.17 xterm        #this part not works :)

得到了下一个:

debug1: Authentication succeeded (keyboard-interactive).
Authenticated to 192.168.1.17 ([192.168.1.17]:22).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: Requesting X11 forwarding with authentication spoofing.
debug1: Sending command: xterm
debug1: Remote: No xauth program; cannot forward with spoofing.
X11 forwarding request failed on channel 0
xterm: Xt error: Can't open display: 
xterm: DISPLAY is not set
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: client_input_channel_req: channel 0 rtype eow@openssh.com reply 0
debug1: channel 0: free: client-session, nchannels 1
Transferred: sent 2656, received 2480 bytes, in 0.1 seconds
Bytes per second: sent 29582.4, received 27622.1
debug1: Exit status 1

从xterm

$ echo $DISPLAY
/tmp/launch-BHtJfJ/org.macosforge.xquartz:0

将其更改为:0无济于事

从xterm运行

$ xauth list
jonatan.local/unix:0  MIT-MAGIC-COOKIE-1  f4f85682af36ae7d95cd3d244cb6beb2
192.168.1.9:0  MIT-MAGIC-COOKIE-1  f4f85682af36ae7d95cd3d244cb6beb2
jonatan.local:0  MIT-MAGIC-COOKIE-1  f4f85682af36ae7d95cd3d244cb6beb2

任何的想法?


您能说明哪些部分不适合您吗?
娴静

@demure我的英语还不够好,我希望比错误提示足够清晰。但是好吧,在问题中添加一条注释,以确切显示出哪些无效。或更确切地说,出于某些奇怪的原因,不能通过ssh进行X协议隧道传输。也许是xauth。感谢您的关注。:)
jm666

Answers:


8

您需要打开XQuartz,转到X11PreferencesSecurity,有两个复选框:禁用第一个,启用第二个。重新启动XQuartz,然后重试。您还需要这样定义$DISPLAY变量:

export DISPLAY=clienthost:0.0

同时,我发现问题出在另一面-不在我的OS X中。还是谢谢你+1。
jm666

@ jm666,Andreu我遇到了同样的问题,该解决方案对我没有用,#jm66您能否分享您解决该问题的经验。
math137

什么clienthost
乔纳森

1

不确定如何发生,但从出现错误消息的SSH来源获取:

/* Try to open a socket for the local X server. */
display = getenv("DISPLAY");
if (!display) {
    error("DISPLAY not set.");
    return -1;
}

它表明ssh确实认为该变量根本没有设置(即没有畸形或某种东西,而是丢失了)。

我不确定SSH是否会更改用户上下文,从而获得不同的环境。你可以试试

ssh -vvv ....

(多个“ v”)以获取更多调试输出,也许这在启动时提供了提示。


哇-好主意多个vvv-要检查。Thanx :)
jm666

好的,希望对您
终端性
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.