I block all Internet traffic for my kids' Linux accounts using iptables. Sometimes I want to allow them to use one program or another. In such cases I enable them to run that programs as another(unlimited) user via sudoers. This time I tried to enable them to use translate-shell and mpg123 for playing sounds/pronouncing translated words:
kiddy ALL= (daddy) NOPASSWD: /usr/bin/trans
However running sudo -u daddy trans en:he -speak -player mpg123 apple as kiddy user shows correct translation in the terminal but doesn't play the sound, stating: "Voice output isn't available for English". Once I log in as daddy in Gnome and run the same command: trans en:he -speak -player mpg123 apple - everything works as expected and I get both the textual translation and the sound playback. Both users belong to the audio group. I tried this approach but id didn't help. I am on Debian 12 and neither on Wayland nor on Xorg there is no file $HOME/.Xauthority which was used for that solution...
How can I cause the translate-shell to playback audio via sudo as another user?