Why ssh -X opens the X aplication on server screen for regular users

asked 2017-04-18 21:37:09 +0000

Andrei Costache gravatar image

updated 2017-04-18 21:40:01 +0000

Hello, I have the following set-up that I use to experiment with SSH:

  • Computer 1 running FC25 running as ssh server
  • Computer 1 has a root user (with root password) and a regular user (regular_username) in the wheel group, but with no set password
  • Computer 2 running Ubuntu (16.10) running as ssh client
  • both computers are in my local home network, behind a router, ....

What works correctly is:

  • I am able to ssh from the client to the server using both the server root and regular_username account.

The strange/unexpected behavior is:

  • when I try to run on the client something like ssh -X root@server_ip_address gedit, then gedit opens somewhat normally on the client screen (I say somewhat normally because the first time I try this it throws some errors and fails, but the second, third, ... time it throws some errors (fewer this time but same as the first time) and then gedit window is shown on the client screen as expected)
  • when I try to run on the client something like ssh -X regular_username@server_ip_address gedit, then the gedit window opens on the server screen. This is totally unexpected to me, as I would expect to get a gedit window on the client display.

In summary, my question is: What do I need to do to get the correct/expected behavior?

PS: Of course that it would be very nice if someone can provide a logical explanation for this behavior...

Many thanks.

edit retag flag offensive close merge delete


Tried some others as well:

  • firefox works as expected when i run it as a regular user (loads on the client screen), but it is slow, slow, slow
  • firewall-config starts on the server screen (abnormally) and fails to fully load because it does not get a root password (which it also does not request... neither on server, nor on client side; it just immediately complains about no root credentials)
Andrei Costache ( 2017-04-18 22:12:41 +0000 )edit

Do not start GUI applications as root, please. None of the toolkits are designed for that. You are risking security and safety, including messing up all of your private home directory.

genodeftest ( 2017-04-18 22:13:52 +0000 )edit

I am very much aware that what I am doing here as root is ill advised. I do not have the intention to do it in the future, I am just doing it now for learning purposes (to study this strange behavior); however, the bad thing for me is that apparently only the root account can consistently start X applications via SSH on my set-up; that's why it is ultra important to get to the bottom of this...

Andrei Costache ( 2017-04-19 04:30:36 +0000 )edit

It would help if you included the errors you are getting.

What is the output of ssh -X regular_username@server_ip_address 'echo $DISPLAY'? Make sure you have those single quotes there, not double.

Samuel Sieb ( 2017-04-19 19:39:26 +0000 )edit

Are you running Wayland on Fedora?

ed209 ( 2017-04-21 01:12:05 +0000 )edit