請教播放音效權限的問題 - Linux

Table of Contents

自己興趣寫了一些自己在家裡玩的服務,碰到了關於音樂播放的問題
(我是覺得跟權限有關係)

想請教一下,

利用自己架設的web App執行mpg123播放音樂時都會出現下面所附錯誤訊息

但是如果是root或是normal_user執行mpg123時卻可以正確播放。



錯誤訊息如下:

Directory: /srv/http/Mysite/static/mp3/
Playing MPEG stream 1 of 1: XXXX.mp3 ...
Home directory not accessible: Permission denied
ALSA lib confmisc.c:768:(parse_card) cannot find card '0'
ALSA lib conf.c:4260:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4260:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1251:(snd_func_refer) error evaluating name
ALSA lib conf.c:4260:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4739:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2267:(snd_pcm_open_noupdate) Unknown PCM default

[sdl.c:76] error: Couldn't open SDL audio: No available audio device


[audio.c:643] error: failed to open audio device

[mpg123.c:547] error: failed to reset audio device: No such file or directory


/etc/group檔案中,已有如下設定

audio:x:92:normal_user,daemon


OS是ArchLinux,希望有經驗的高手能指點一下。


謝謝

--

All Comments

Connor avatarConnor2015-05-09
web service 的 user 沒加 group ?
Emily avatarEmily2015-05-12
沒錯,加user以後便可以了,謝謝