开发者

On Linux, how do I run a GUI app from a terminal shell under a different login?

Here's the dea开发者_StackOverflow社区l. I logged into a Linux box (CentOS, but that shouldn't matter) as user A. I had to build a program as user B, so I started up a terminal shell, logged into that shell as B, and built it. When I try to run the app, 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 permissions to access A's stuff.

Is there a correct way to solve this. Any incorrect ways?


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

sudo -i userB

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


ssh -X userb@localhost

(and someone with more rep than me should move this to SU)


I found ssh -Y ... worked as well.


xhost +localhost opens your box to allow all users on your box to run their X software on your screen. Obviously, this also allows for practical jokes from other users.


xhost +

From user who ran X server.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜