On Linux, how do I launch a GUI application from a terminal shell under a different name?

Here's the deal. I logged into a Linux box (CentOS, but that shouldn't matter) as user A. I had to create the program as user B, so I ran a shell terminal logged into that shell as B and built it. When I try to run the application, I get this message:

"connect to": 0.0 "refused by server"

Most likely because the current X Windows session is owned by user A, and as B, I don't have permission to access the stuff.

Is there any correct way to solve this problem. Any wrong ways?

+2


a source to share


5 answers


I found it ssh -Y ...

worked.



0


a source


I'm not sure how you logged in, but if it was something like this:

sudo -i userB

      



the DISPLAY and TERM variables remain unchanged, and you may need to set them.

+1


a source


ssh -X userb@localhost

      

(and someone with a bigger reputation than me should move this to SU)

0


a source


xhost +localhost

a window opens allowing all users on your box to run their X software on your screen. Obviously, this also allows for practical jokes from other users.

0


a source


xhost +

      

From the user who started the X server.

-1


a source







All Articles