Try using "su -" to get a login shell. For example:
# su - user -c pwd
/home/user
# su user -c pwd
/root
You are trying to run pulseaudio in root's environment with the user's
permissions.
Regards,
Martin
>-----Original Message-----
>From: centos-bounces at centos.org [mailto:centos-bounces at centos.org] On
>Behalf Of Jerry Geis
>Sent: 08 May 2014 14:58
>To: centos at centos.org
>Subject: [CentOS] su command
>
>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
>_______________________________________________
>CentOS mailing list
>CentOS at centos.org
>http://lists.centos.org/mailman/listinfo/centos
This email and any attachments to it may be confidential and are
intended solely for the use of the individual to whom it is
addressed. If you are not the intended recipient of this email,
you must neither take any action based upon its contents, nor
copy or show it to anyone. Please contact the sender if you
believe you have received this email in error. QinetiQ may
monitor email traffic data and also the content of email for
the purposes of security. QinetiQ Limited (Registered in England
& Wales: Company Number: 3796233) Registered office: Cody Technology
Park, Ively Road, Farnborough, Hampshire, GU14 0LX http://www.qinetiq.com.