:: Re: [DNG] Firefox, sudo and apulse …
Página Inicial
Delete this message
Reply to this message
Autor: hal
Data:  
Para: dng@lists.dyne.org
Assunto: Re: [DNG] Firefox, sudo and apulse (was Re: Steam, Mumble, Valheim, Alsa and shared audio)


On 8/31/21 11:02, g4sra via Dng wrote:
<snip>
>
> In case you are unaware....
> To simplify the GUI side, use 'xauth'
>
> get user_one's cookie:
> user_one# xauth -n list localhost/unix:0
> localhost/unix:0 MIT-MAGIC-COOKIE-1 83c12a394ac0c5afe1fee0a973b9e49g
>
> then give the cookie to user_two:
> user_two# xauth add localhost/unix:0 MIT-MAGIC-COOKIE-1 83c12a394ac0c5afe1fee0a973b9e49g
>
> now 'user_two' can access the GUI (you may need to set DISPLAY):
> user_two# DISPLAY=:0 /usr/bin/apulse /home/apps/firefox/firefox -ProfileManager
>
> I do this so frequently for 'root' that I have a two-line bash script I called 'xsudo.sh'
>
> #!/usr/bin/env bash
> sudo bash -c "xauth add $(xauth -n list localhost/unix:0) && exec $@ &"



Ok I tried this today but I think I have something wrong. Are you running all these as root (I see # in your prompt)? Here is what I tried:

user1 $xauth -n list localhost/unix:0
user1 $xauth -n list
beowulf/unix:0 MIT-MAGIC-COOKIE-1 4e9c9fca69b03a0b270ce53237df2fca

user1 $sudo -u webuser /bin/bash --login
No protocol specified
Cannot open display ":0.0"
No protocol specified
Cannot open display ":0.0"

webuser $xauth add beowulf/unix:0 MIT-MAGIC-COOKIE-1 4e9c9fca69b03a0b270ce53237df2fca
xauth: timeout in locking authority file /home/user1/.Xauthority
webuser $