6

I'm running a Ubuntu server in VMWare. And I would like to forward the X11 from the Ubuntu guest to the Mac host.

I've installed XQuartz 2.7.9 (xorg-server 1.17.4) on the Mac host.

And SSH forwarding on the Ubuntu is enabled.

Then I tried the following in iTerm:

%> echo $DISPLAY /private/tmp/com.apple.launchd.mjxVyILVrR/org.macosforge.xquartz:0 %> ssh -X root@xxxx # echo $DISPLAY # gnome-terminal Unable to init server: Could not connect: Connection refused Failed to parse arguments: Cannot open display 

$DISPLAY is empty, and X11 forwarding is not working.

Any ideas?

4
  • Post verbose log from the ssh -X -vvv root@xxxx to see what is going on there. Commented Sep 23, 2016 at 6:49
  • Make sure you have xauth installed at both sides, try adding the -Y flag to the ssh command Commented Sep 23, 2016 at 7:54
  • @TimFletcher /usr/bin/xauth: file /root/.Xauthority does not exist, weird. It actually exists with permission 0600 Commented Sep 23, 2016 at 10:12
  • Could there be restrictions on xforwarding for root? Commented Sep 23, 2016 at 10:35

4 Answers 4

3

Try running ssh -Y root@xxxx in xterm inside XQuartz instead of from iTerm. Does that work?

1

open /etc/ssh/sshd_config in remote system and set X11Forwarding yes . Then restart ssh service and try again

1
  • It's already enabled .. Commented Sep 23, 2016 at 5:49
1

Correct me if I am wrong. You want to access your machine running Ubuntu remotely from your mac and when you 'ssh' into your Ubuntu and when you try to 'echo $DISPLAY' you get an empty response. Probably the following solution might not work in your case, but give it a try if what you were trying is similar to what I have tried.

As you have already found one has to find the DISPLAY variable first.

So in your mac if you type as a normal user

echo $DISPLAY 

Then what you would get is something like the following (It is the case in your hand). Anyway you all would see something similar in your systems.

/private/tmp/com.apple.launchd.0aQYNoXMFK/org.xquartz:0 

Then try something like

xeyes 

And now you know that your display is working

Now if you want to try the same as root (Please don't jump on me guys, I know some of you all are strongly against root access), but if does not work then in your root prompt do the following

export DISPLAY=/private/tmp/com.apple.launchd.0aQYNoXMFK/org.xquartz:0 

The same you found in your normal user account. Then copy your '.Xauthority' at '/Users/normal user/.Xauthority' to '/var/root/'. The .Xauthority file is already there, but this would over right it.

cp /Users/normal user/.Xauthority /var/root/ 

Of course the export might work, but there is no harm in doing the above. Now try the following.

echo $DISPLAY 

And you should see the following

/private/tmp/com.apple.launchd.0aQYNoXMFK/org.xquartz:0 

If you 'ssh' into Ubuntu from normal user prompt then you do not need to do the root part, but since, I use root to 'ssh' my Ubuntu systems I often have to do this.

Then when you 'ssh into Ubuntu type

echo $DISPLAY 

And you would see something like the following

localhost:10.0 

The above would work if you have done all those other bits like forwarding and etc.

Again, if you want to use root in your Ubuntu and if the 'echo $DISPLAY' does not produce any response, then try the following (Assuming you are at root prompt).

cp /home/user name/.Xauthority /root/.Xauthority 

Now try

echo $DISPLAY 

again and you would see something like the following

localhost:10.0 

For fun try

xeyes 

And it works in my case. Hope this is helpful and would solve a problem like the one above or like mine that someone has come across and who spent a few hours on this problem while scratching head and trying to pull hair out like me :-)).

0

After trying a lot of different options, this is what worked for me:

On my Mac:

I first launch xQuartz. Then I go to my terminal and run export DISPLAY=localhost:0.

On my remote linux PC:

I had issues with wayland so I went to /etc/gdm/custom.conf and uncommented the line WaylandEnable=false. I also set export XAUTHORITY=$HOME/.Xauthority. And lastly, I set export QT_QPA_PLATFORM=xcb which is what made some graphical libraries is python work.

After setting this up, you can now ssh into your remote server using ssh -Y remoteserver@IP and hopefully this should work.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.