You are not logged in.

#1 2019-03-01 13:02:36

spirit369
Member
Registered: 2019-02-13
Posts: 10

Running games as different user (su) - Audio problems

Hi Archlinux experts smile
- Noob is here! -

I'm using Archlinux with Cinnamon desktop.

I play games on linux (like teeworlds and minetest) and want to run them as different user, just in case, to prevent any security problems with the games.
But I don't want to re-login with the games user, so I use su.

I use the xhost command to allow the games user to use the graphical display and it works, but I can't "share" the sound device with that user, so the games are silent.

How can I give the su'ed user access the audio device? (Is it possible?)

Many thanks!

Last edited by spirit369 (2019-03-01 13:03:16)

Offline

#2 2019-03-01 14:51:00

bugsmanagement
Member
Registered: 2017-04-21
Posts: 201

Re: Running games as different user (su) - Audio problems

Hello there,

Are you using Pulseaudio as your sound server? If so, one option is to share your sound server, by configuring the environment for the application to find it:

#THIS IS AN EXAMPLE
PULSE_SERVER=unix:/run/user/$UID/pulse/native
PULSE_COOKIE=/home/normaluser/.pulse/cookie

Regards

Offline

#3 2019-03-01 14:52:55

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,797

Re: Running games as different user (su) - Audio problems

spirit369 wrote:

But I don't want to re-login with the games user, so I use su.

Is that because you do not want to log out as your primary user?
What about switching to a different console and logging in as the game user while leaving your primary user on console 1?
You can switch consoles with ctrl-alt-F2 (to change to console 2, F1 to go back to console 1. By default there are six consoles. [F1-F6])

If that does not answer the mail, how about running it under qemu?  (depending on how intensive the game is)


You might try su -l to see if it does a better job of setting up the environment.  Not sure about this one and I'm afraid I don't have the time this morning to try it.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#4 2019-03-01 16:53:43

spirit369
Member
Registered: 2019-02-13
Posts: 10

Re: Running games as different user (su) - Audio problems

Thanks for your replies friends!

@bugsmanagement:
It didn't work out just by setting these parameters, but I found out a way to do it thanks to your recommendation.
I edited /etc/pulse/default.pa and added this line to enable a tcp server:
load-module module-native-protocol-tcp auth-anonymous=true

Then on the 'games' user, I've set "PULSE_SERVER=127.0.0.1" and it worked.
I'm still not happy with having a tcp server just for this... hmm

@ewaller:
Yes, I want to remain in the same session and just have a game window running on different user.
Switching to other console does not bring me a different graphical interface. If it's possible to have two graphical sessions please let me know how. I mentioned that I am a newbie right? wink
About the "su -l" - it didn't change anything. And as for qemu - I'll have to read about this because it's new to me.

Many thanks again!

Offline

Board footer

Powered by FluxBB