Ubuntu root下无声音问题

本文提供了一种在Ubuntu系统中以root用户身份启用声音的方法。主要包括将root用户添加到pulse和pulse-access组中,修改/etc/default/pulseaudio配置文件,并重启系统以使更改生效。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Ubuntu root下默认关闭声音,通过如下步骤开启声音

1. 将root加入到pulse和pulse-access中

usermod -a -G pulse-access root
gpasswd -a root pulse
gpasswd -a root pulse-access

2. 修改/etc/default/pulseaudio文件

cp -p /etc/default/pulseaudio/etc/default/pulseaudio.bak
vi /etc/default/pulseaudio

默认为

# Start the PulseAudio sound server in system mode.
# (enables the pulseaudio init script - requires that users be in the
# pulse-access group)
# System mode is not the recommended way to run PulseAudio as it has some
# limitations (such as no shared memory access) and could potentially allow
# users to disconnect or redirect each others' audio streams. The
# recommended way to run PulseAudio is as a per-session daemon. For GNOME/KDE/
# Xfce sessions in Ubuntu Lucid/10.04, /etc/xdg/autostart/pulseaudio.desktop
# handles this function of automatically starting PulseAudio on login, and for
# it to work correctly your user must *not* have "autospawn = no" set in
# ~/.pulse/client.conf (or in /etc/pulse/client.conf). By default, autospawn
# is enabled. For other sessions, you can simply start PulseAudio with
# "pulseaudio --daemonize".
# 0 = don't start in system mode, 1 = start in system mode
PULSEAUDIO_SYSTEM_START=1
 
# Prevent users from dynamically loading modules into the PulseAudio sound
# server. Dynamic module loading enhances the flexibility of the PulseAudio
# system, but may pose a security risk.
# 0 = no, 1 = yes
DISALLOW_MODULE_LOADING=0

将PULSEAUDIO_SYSTEM_START=1改为0, DISALLOW_MODULE_LOADING=0改为1

3. 重启,使设置生效

PS. 如果要以普通用户登录,则把.bak文件恢复即可


来源: http://blog.chinaunix.net/uid-9688646-id-3275005.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值