3 ms·
I think they mean mute the mic, do the actual sudo then unmute. A proof of concept script that I have hacked together from some other things I have (untested b
by seanhunter 5y ago
I think they mean mute the mic, do the actual sudo then unmute. A proof of concept script that I have hacked together from some other things I have (untested because I'm on my mac not my linux laptop atm) would look like this for linux
#!/bin/bash
set -euo pipefail
#Get current mute status
SINK=$( pactl list sinks | sed 's/Sink #//;q' )
current_pa=$(pactl list sinks | awk '/Mute/{print $2}' )
current_cap=$(amixer cset iface=MIXER,name='Capture Switch' | awk -F= '/: values/{print $2}')
#mute it
pactl set-sink-mute "${SINK}" 1
amixer cset iface=MIXER,name='Capture Switch' off,off > /dev/null
/usr/bin/sudo "$@"
#put it back the way it was before
pactl set-sink-mute "${SINK}" $current_pa
amixer cset iface=MIXER,name='Capture Switch' "$current_cap" > /dev/null
I think you might only need the amixer part to mute the mic but I'm muting the speaker as well with pactl.
- marcan_42 5y agoClose. That wouldn't work for long-running commands, since they'd keep the mic muted. Instead I use a sudo askpass wrapper to only mute during the password prompt bit.
- BossingAround 5y agoWhat problem does it solve? You mute your mic, do sudo, then unmute it. Why?
- seanhunter 5y agoThere is an attack whereby if someone can record audio of you typing your password, they can get information helpful to cracking your password.
- seanhunter 5y agoOh yeah that makes more sense.