You are not logged in.
Is there a possible way to play a specific soundfile of my liking each time it asks for sudo password to enter? So far I have no clue how to do so but just know it has to be in a script of course.
Offline
Sudo has the flag -B for "bell" which will play a sound ... just not a soundfile of your choice.
Otherwise you could use the -A flag to specify your own password entry program which in turn could play the sound file and ask for a password. However, if this is a script, make sure it is owned and only modifiable by the root user.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
just tested
sudo -B rm -f test
a slight bell tone when System Volume is set to 120% and soundcard to 200%
will it help if I create an alias for sudo? like
alias sudo='mplayer sudosound.ogg'
will play the sound and at the same time doing the sudo task.
Offline
No, it'll play a soundfile instead of actually running sudo and it will do so unconditionally - whether you've to issue a password or not.
Most TEs allow you to configure the bell (soundfile, beep, volume, colorflash, …) so you might look into that.
Edit:
printf '\a'
will play the bell as well (for testing your TE settings)
Last edited by seth (2021-11-14 15:54:14)
Online
TE
as of Terminal Environment?
I use Guake and can only see 1 box regarding to sound which is under General for "Play system alert sound on bell".
under Hooks I can see an empty box that leads by "on Show:" for "In this dialog you can attach your own command or script to various Guake events". Is this the right direction I am looking at?
Last edited by FreddyMalone (2021-11-14 16:10:28)
Offline
"terminal emulator" - the options seems to allow you to play the alert from your sound scheme (which you can configure in your desktop environment settings, likely gnome?)
Edit: you'll have to try or wait for somebody to show up who uses guake - I'm navigating this by google image search ;-)
Last edited by seth (2021-11-14 16:16:00)
Online
TE = Terminal Emulator, but yes, guake is one of these. I'm not familiar with guake, but if it allows you to customize how it responds to the terminal "bell", that would actually be the ideal way for you to achieve your end goal, and the "guake events" sounds like the promising direction to continue down.
Note that even a proper alias for sudo would not really achieve your goals as it'd play the sound every time sudo was called even if no password was required. And it could fail for any script that either calls /bin/sudo directly or otherwise doesn't inherit the alias (i.e., makepkg's calls to sudo might not use the alias).
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
alias sudo='mplayer /home/user/Music/sudosound.ogg; sudo'
how about this? to me, it looks good but haven't tested it yet. Want to read from you before I 'hear' it
Offline
Offline
Read Trilby's second paragraph.
I've overseen it, thanks for the reminder.
Offline