I am running pulseaudio on centOS 6.5 audio works fine as the user. running the command aplay /usr/share/sounds/alsa/Front_Center.wav works fine. when I login as root and run the command su user -c "aplay /usr/share/sounds/alsa/Front_Center.wav" it does not work. I thought su actually runs as that user... is there some "magic" to su I don't know about? How might I get that to work ? Thanks, jerry
On 5/8/2014 7:57 AM, Jerry Geis wrote:> I am running pulseaudio on centOS 6.5 > audio works fine as the user. > running the command > aplay /usr/share/sounds/alsa/Front_Center.wav > works fine. > > when I login as root and run the command > su user -c "aplay /usr/share/sounds/alsa/Front_Center.wav" > it does not work. > > I thought su actually runs as that user... > is there some "magic" to su I don't know about? > How might I get that to work ? > > > Thanks, > > jerryIf the program works normally from that user's account then you need that user's environment and to get that you use the - (dash) switch. So your command would look like: su - user -c "aplay /usr/share/sounds/alsa/Front_Center.wav" This is why when we switch user to root we use: su - ...to ensure we get root's environment. See the man page for su. -- steve
On Thu, May 8, 2014 at 8:57 AM, Jerry Geis <geisj at pagestation.com> wrote:> I am running pulseaudio on centOS 6.5 > audio works fine as the user. > running the command > aplay /usr/share/sounds/alsa/Front_Center.wav > works fine. > > when I login as root and run the command > su user -c "aplay /usr/share/sounds/alsa/Front_Center.wav" > it does not work. > > I thought su actually runs as that user... > is there some "magic" to su I don't know about? > How might I get that to work ?There is magic in who 'owns' certain devices which probably includes audio and it has some relationship to logging in at the console. (As if 'the console' has some meaning in unix-like systems...). -- Les Mikesell lesmikesell at gmail.com