Macos – How does X11 work

centosmacosxorg

I'm trying to get X11 to work on my mac when connecting to a remote machine, and having lots of trouble. I have spent all day googling to no avail. Here are my main questions:

  1. What is the difference between ssh -X, ssh -Y, and when I do this which computer (local or remote) has the x server, and which has the clients?

  2. Does the startx command start the x server? So if I go to my terminal and hit startx all i've done is start the xserver?

  3. Why would I ever want to ssh into a remote computer and use startx? Would I need -X or -Y to use startx? It seems everything I've read about getting the desktop up for gnome/kde on a remote machine calls for you ro use startx. If I use startx in this scenario, who is the xserver, and who is the xclient?

  4. Will the window managers of gnome/kde from using startx on the remote machine interfere with mac's implementation of its own x11 window manager? is there anyway to fix it?

  5. How does something like VNC play into all of this? Is there a difference between a remote X session and just sshing into the remote machine and using startx?

  6. What is the correct way/command to get gnome/kde to run a GUI desktop on my remote machine of the server? (so the desktop displayed on my computer is the desktop of the server)? And by desktop, I mean I want wallpaper, folders, recycle bin, etc.

  7. If NX/VNC are the only ways to correctly have a true remote desktop in the sence of #6, why do the commands $gnome-session or $startkde bring up the desktop i want with ssh -X even though they don't work correctly?

It would be helpful if each of these were addressed individually, but if you can lead me towards some clear documentation that would be helpful too!

Best Answer

  1. If I recall correctly ssh -X maps the X server to the target machine and then routes connections through the channel created by SSH to the terminal (i.e. your machine). The "X server" is the software that draws the window for the "X clients" which are the programs that use those windows.

  2. Yes, startx starts the X server. But on Mac OS X you start the X server by starting X11.app in Utilities.

  3. You wouldn't really want that unless you are trying to restart the X server on the computer you SSH into. But that wouldn't have anything to do with your connection to that computer or the programs you want to run via that connection.

  4. Not sure I understand the question. What window manager the remote server runs is inconsequential for your connection. Window managers run on X servers (they are special X clients) and the X server on your Mac and the X server on the remote machine are two separate beasts.

  5. VNC is a different solution for the problem of displaying GUI apps remotely. You can combine the two but I recommend you try to understand them separately.

  6. Let Paul be your Mac and Peter be the (Linux) machine you connect to:

Paul: startx (or rather, start X11.app and use the terminal window it creates for the following)

Paul: xhost +Peter

Paul: ssh -X Peter

Peter: xlogo& (this should now display on Paul's screen, if not, continue)

Peter: export DISPLAY=Paul:0

Peter: xlogo& (this should now display on Paul's screen)

Related Question