You are not logged in.

#1 2023-10-28 23:11

NTNozomu
Member
Registered: 2023-10-28
Posts: 2

Using sudo to run programs as another user (UID 128 - SEE) no audio?

Hello, this may be an odd question, but we have programs that we want to run as a shared psuedo-sandboxed user (SEE) using

sudo -u SEE (command)

and I have run the command

xhost +

to allow GUI connections to the active session, but when running the program, it works, but there is no sound and it complains that it can't initialize PulseAudio. We want it to connect to the logged-in user's instance of PulseAudio, not starting another instance. The intent is to share programs, and all associated data, by running them as SEE, so that when a logged in user clicks the shortcut, it actually runs a shell script that does setup first (xhost, etc) before launching the program, and to them, it looks the same as if it is running as their account (outside of the different theme and different user name). The reason is that we have DID and each alter wants privacy, but we want to share virtual machines, Discord, and other applications we typically make copies of.

We are Linux noobs so go easy on us, we have done this on Windows NT (8.1, Server 2012, Server 2016, 10 1607-1709, Server 2019, 10 LTSC 2019, and 10 LTSC 2021 also with a user named SEE, but set to Power Users using lusrmgr.msc) using runas and the save credentials flag without having audio issues like this (the theme being different happens on both - we have zero intent to fix that as it allows "SEE" applications and "user" applications to be told apart).

Specific programs are allowed to run NOPASSWD in sudoers (not an exhaustive list, just an example):

%sudo   ALL=(ALL:ALL) ALL
%seirei ALL=(SEE)       NOPASSWD: /usr/bin/virtualbox
%seirei ALL=(SEE)       NOPASSWD: /usr/bin/discord

My current script (/usr/bin/virtualbox_see):

#!/bin/bash
pulseaudio --start &
xhost +
sudo -u SEE /usr/bin/virtualbox
exit 0

which gets me 90% of the way there, but without sound.

Can anyone help me? It will be greatly appreciated by us.

Offline

Board footer

Powered by FluxBB