Cannot get Mac to display X11 window on another Mac

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Cannot get Mac to display X11 window on another Mac

Simon C. Leemann
I have two Macs at work, one 'remote' station on HS the other 'local' station on El Cap. Both have the latest XQuartz installed and work fine for using X11 apps locally. So for example, xterm& will open a new terminal window on both systems just fine. The problem arrises when I log onto the remote Mac from the client Mac using ssh -X simon@remoteMac. I simply cannot get xterm& to display on the local Mac. It always opens up on the remote Mac instead. With my linux boxes that's not the way it works and AFAIK this is not the intended behavior either (considering I'm using the -X flag). Is there a simple way to fix this behavior?

Thanks,
Simon





____________TidBITS Talk Participation Guidelines____________
Post only when you have something substantive to contribute.
Be polite and constructive, and comment on posts, not people.
Quote sparingly, if at all. We all read the previous message.
Start threads with a new message to [hidden email].
Read archives at: http://tidbits.com/pipermail/tidbits-talk/
Unsubscribe at: http://tidbits.com/mailman/options/tidbits-talk
____Mailing List Manners: http://tidbits.com/series/1141 ____
Reply | Threaded
Open this post in threaded view
|

Re: Cannot get Mac to display X11 window on another Mac

Paul Schinder


> On Oct 27, 2017, at 12:58 AM, Simon C. Leemann <[hidden email]> wrote:
>
> I have two Macs at work, one 'remote' station on HS the other 'local' station on El Cap. Both have the latest XQuartz installed and work fine for using X11 apps locally. So for example, xterm& will open a new terminal window on both systems just fine. The problem arrises when I log onto the remote Mac from the client Mac using ssh -X simon@remoteMac. I simply cannot get xterm& to display on the local Mac. It always opens up on the remote Mac instead. With my linux boxes that's not the way it works and AFAIK this is not the intended behavior either (considering I'm using the -X flag). Is there a simple way to fix this behavior?

I just tried logging into my MacPro from my MacBook Pro and xterm popped up correctly with the window on my MacBook and the shell on the MacPro.  So I’d check your settings in both /etc/ssh/sshd_config and /etc/ssh/ssh_config.  ForwardX11 should be “yes”, and XAuthLocation should be /usr/X11/bin/xauth.  And make sure that you’re not setting DISPLAY anywhere on the remote machine.  Let ssh do that.

Apple runs a list for problems with X11: https://lists.apple.com/mailman/listinfo/x11-users

>
> Thanks,
> Simon
>
>
>


--
Paul Schinder
[hidden email]





____________TidBITS Talk Participation Guidelines____________
Post only when you have something substantive to contribute.
Be polite and constructive, and comment on posts, not people.
Quote sparingly, if at all. We all read the previous message.
Start threads with a new message to [hidden email].
Read archives at: http://tidbits.com/pipermail/tidbits-talk/
Unsubscribe at: http://tidbits.com/mailman/options/tidbits-talk
____Mailing List Manners: http://tidbits.com/series/1141 ____
Reply | Threaded
Open this post in threaded view
|

Re: Cannot get Mac to display X11 window on another Mac

Simon C. Leemann
In reply to this post by Simon C. Leemann
On Oct 29, 2017, at 10:44 AM, Paul Schinder wrote:
>
> I just tried logging into my MacPro from my MacBook Pro and xterm popped up correctly with the window on my MacBook and the shell on the MacPro.  So I’d check your settings in both /etc/ssh/sshd_config and /etc/ssh/ssh_config.  ForwardX11 should be “yes”, and XAuthLocation should be /usr/X11/bin/xauth.  And make sure that you’re not setting DISPLAY anywhere on the remote machine.  Let ssh do that.

Thanks, Paul.

I checked that for both remote and local Mac I have ForwardX11 set to "yes" (it was "no" but the line was commented out). The local Mac has DISPLAY set to /private/tmp/com.apple.launchd.cRGZdMO4Rs/org.macosforge.xquartz:0
(no idea how/why that is being set, there's nothing in ~/.bashrc), but the remote Mac has nothing set as confirmed with echo $DISPLAY. So I would assume that I can let ssh do that via the X or Y flags as you indicate.

But when I do
  ssh -X simon@remoteMac
and then log on I get this when trying xterm
remoteMac:~ simon$ xterm
xterm: Xt error: Can't open display:
xterm: DISPLAY is not set
remoteMac:~ simon$

The crazy thing is that it works perfectly fine the other way around. If I do an ssh -X from my remote Mac to my local Mac I can then type xterm& and I get the remote Mac to display the xterm shell that's now running from the local Mac.

Both Macs have /usr/X11/bin/xauth set up and working AFAICT; they are using ~/.Xauthority which exists on both Macs. Could I simply set the DISPLAY variable on the remote Mac as it is on the local Mac to get it to work?

Any other ideas?

Thanks,
Simon




____________TidBITS Talk Participation Guidelines____________
Post only when you have something substantive to contribute.
Be polite and constructive, and comment on posts, not people.
Quote sparingly, if at all. We all read the previous message.
Start threads with a new message to [hidden email].
Read archives at: http://tidbits.com/pipermail/tidbits-talk/
Unsubscribe at: http://tidbits.com/mailman/options/tidbits-talk
____Mailing List Manners: http://tidbits.com/series/1141 ____
Reply | Threaded
Open this post in threaded view
|

Re: Cannot get Mac to display X11 window on another Mac

Paul Schinder

> On Oct 30, 2017, at 1:54 PM, Simon C. Leemann <[hidden email]> wrote:
>
> On Oct 29, 2017, at 10:44 AM, Paul Schinder wrote:
>>
>> I just tried logging into my MacPro from my MacBook Pro and xterm popped up correctly with the window on my MacBook and the shell on the MacPro.  So I’d check your settings in both /etc/ssh/sshd_config and /etc/ssh/ssh_config.  ForwardX11 should be “yes”, and XAuthLocation should be /usr/X11/bin/xauth.  And make sure that you’re not setting DISPLAY anywhere on the remote machine.  Let ssh do that.
>
> Thanks, Paul.
>
> I checked that for both remote and local Mac I have ForwardX11 set to "yes" (it was "no" but the line was commented out). The local Mac has DISPLAY set to /private/tmp/com.apple.launchd.cRGZdMO4Rs/org.macosforge.xquartz:0
> (no idea how/why that is being set, there's nothing in ~/.bashrc), but the remote Mac has nothing set as confirmed with echo $DISPLAY. So I would assume that I can let ssh do that via the X or Y flags as you indicate.
>
> But when I do
>  ssh -X simon@remoteMac
> and then log on I get this when trying xterm
> remoteMac:~ simon$ xterm
> xterm: Xt error: Can't open display:
> xterm: DISPLAY is not set
> remoteMac:~ simon$
>
> The crazy thing is that it works perfectly fine the other way around. If I do an ssh -X from my remote Mac to my local Mac I can then type xterm& and I get the remote Mac to display the xterm shell that's now running from the local Mac.
>
> Both Macs have /usr/X11/bin/xauth set up and working AFAICT; they are using ~/.Xauthority which exists on both Macs. Could I simply set the DISPLAY variable on the remote Mac as it is on the local Mac to get it to work?
>
> Any other ideas?

Make sure that the following lines (uncommented) are in sshd_config

X11Forwarding yes
XAuthLocation /usr/X11/bin/xauth

and ssh_config

ForwardX11 yes
XAuthLocation /usr/X11/bin/xauth


I just tried going from my MacPro to my MacBook and it was failing until I made the changes on my MacBook (it was already properly set up on my MacPro).  Now it works both ways.

Setting DISPLAY by hand or in a login script (and there are many to choose from) is the major cause of failure.  You really need to let sshd do it itself on the remote and let XQuartz do it on the local.  On the local machine, the Apple X11 uses a (formerly) non-standard way that leads to the path DISPLAY you see on the local.  Mine is currently

mp$ echo $DISPLAY
/private/tmp/com.apple.launchd.TlGFGxgvmO/org.macosforge.xquartz:0

On the remote it’s usually

mbp13r$ echo $DISPLAY
localhost:10.0

after logging into the remote.  If it’s not something like that, it’s not going to work because the sshd tunnel won’t be there to make it work, so it’s pointless to try to just set it.

> Thanks,
> Simon
>


--
Paul Schinder
[hidden email]






____________TidBITS Talk Participation Guidelines____________
Post only when you have something substantive to contribute.
Be polite and constructive, and comment on posts, not people.
Quote sparingly, if at all. We all read the previous message.
Start threads with a new message to [hidden email].
Read archives at: http://tidbits.com/pipermail/tidbits-talk/
Unsubscribe at: http://tidbits.com/mailman/options/tidbits-talk
____Mailing List Manners: http://tidbits.com/series/1141 ____
Reply | Threaded
Open this post in threaded view
|

Re: Cannot get Mac to display X11 window on another Mac

Simon C. Leemann
In reply to this post by Simon C. Leemann
Thanks, Paul.

I noticed the line
  XAuthLocation /usr/X11/bin/xauth
was missing from my remote Mac's /etc/ssh/sshd_config (it was inserted in the ssh_config though, apparently by XQuartz). I added it by hand and then restarted XQuartz on the remote Mac along with sshd (no idea if that was really necessary). And sure enough, now it's working as intended. :)

Many thanks!

Best,
Simon




____________TidBITS Talk Participation Guidelines____________
Post only when you have something substantive to contribute.
Be polite and constructive, and comment on posts, not people.
Quote sparingly, if at all. We all read the previous message.
Start threads with a new message to [hidden email].
Read archives at: http://tidbits.com/pipermail/tidbits-talk/
Unsubscribe at: http://tidbits.com/mailman/options/tidbits-talk
____Mailing List Manners: http://tidbits.com/series/1141 ____