You are not logged in.

#1 2021-12-29 09:03:24

kox
Member
Registered: 2015-05-01
Posts: 149

[SOLVED] Launch application as another non-root user in Sway / Wayland

... without using XWayland

At first I have not installed XWayland. When I tried to run a gui app as another non-root user, it failed "cannot open display" The command I tried was:

sudo --preserve-env=XDG_SESSION_TYPE --preserve-env=WAYLAND_DISPLAY --preserve-env=DISPLAY --preserve-env=XDG_RUNTIME_DIR -u internet firefox

I have noticed that the DISPLAY variable was not set.

Then I have installed XWayland and ran xhost si:localuser:internet which is what I'm using on my old xorg setup and ran the command without any environment variables - and it worked - but I have a high DPI screen and it seems like scale does not work properly in XWayland yet (it's blurry).

Is there a way to open an application as another non-root user without using XWayland?

Last edited by kox (2022-01-02 18:59:08)

Offline

#2 2021-12-29 10:03:45

progandy
Member
Registered: 2012-05-17
Posts: 5,321

Re: [SOLVED] Launch application as another non-root user in Sway / Wayland

You need to give the second user full access to the wayland socket that is stored in XDG_RUNTIME_DIR.


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' | alias ENGLISH='LANG=C.UTF-8 ' |

Offline

#3 2021-12-29 14:05:02

kox
Member
Registered: 2015-05-01
Posts: 149

Re: [SOLVED] Launch application as another non-root user in Sway / Wayland

Thanks for your reply. Do you know where the socket file is relative to the dir?

Offline

#4 2021-12-29 14:18:28

kox
Member
Registered: 2015-05-01
Posts: 149

Re: [SOLVED] Launch application as another non-root user in Sway / Wayland

I got it. It works. Thanks.

Maybe it's a topic for a different question but I wonder how secure it would be. I'm using secondary users to sandbox my home directory from applications they run. Is it possible to leak filesystem access via a shared socket or is it "only" what is displayed on screen and perhaps keyboard input? I was using xorg earlier and I know it's not a perfect security isolation, but I hoped that Wayland would offer some improvement here.

Offline

Board footer

Powered by FluxBB