-1

I am running this process on Linux. This is a server process that does not have direct connection to X Server. The process needs to run an X utility tool ( xinput command). The xinput command is being fork off and exec from the server process. The problem that I have is when the xinput command is executed, it received "Unable to connect to X server". This is understandable because command was not executed from the desktop environment. The server is running on a workstation that has a desktop. It just that the server process was not started from the desktop. Is there a way for server process to connect X server so that xinput can be executed ? Thanks for your time.

tadpole
  • 1,209
  • 7
  • 19
  • 28
  • Yes! Well, maybe. In X, the X client programs ‘know’ how to connect via environment variables or the special command-line options. See: https://gerardnico.com/ssh/x11/display , https://en.wikipedia.org/wiki/X_Window_authorization - depending on exact configuration it may need to be a network connection. Anyway, just tell the client program how to “phone home” and grant connectivity and authorization. Tunnels can also be very useful. – user2864740 Oct 04 '19 at 01:57
  • And still closing as OT.. see the general / *ix SE sites. – user2864740 Oct 04 '19 at 02:02

1 Answers1

0

I found my solution. In case someone else has similar question. Here is my solution. Create 2 files -- A shell file and another file that you are accessing from X utility command. I use bash shell but you can use some other shell. The yourCommand is the script where you want to access X stuff. The DISPLAY must be set before running ssh.

#!/usr/bin/bash
export DISPLAY=0.0
ssh -X workstation yourCommand
tadpole
  • 1,209
  • 7
  • 19
  • 28