I am trying to change the default sudo prompt that is used in macos to match what I am used to in linux. I want to know that I am expected to put my sudo password and not some other password.
I tried the ENV SUDO_PROMPT
variable prompt first
❯ set SUDO_PROMPT '[sudo] %p : '
❯ echo $SUDO_PROMPT
[sudo] %p :
❯ sudo -v
Password:
sudo: a password is required
This is not working.
From the sudo documentation
passprompt_override
The password prompt specified by passprompt will normally only be used if the
password prompt provided by systems such as PAM matches the string “Password:”.
If passprompt_override is set, passprompt will always be used. This flag is off
by default.
Yet when I tried to add this to sudoers file I keep getting an error. I guess I don't understand how the defaults override in sudo is supposed to work. There aren't vary good examples of setting boolean flags online that I could find.
sudo visudo /etc/sudoers
Password:
#
# Sample /etc/sudoers file.
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the sudoers man page for the details on how to write a sudoers file.
##
# Override built-in defaults
##
Defaults env_reset
Defaults env_keep += "BLOCKSIZE"
Defaults env_keep += "COLORFGBG COLORTERM"
Defaults env_keep += "__CF_USER_TEXT_ENCODING"
Defaults env_keep += "CHARSET LANG LANGUAGE LC_ALL LC_COLLATE LC_CTYPE"
Defaults env_keep += "LC_MESSAGES LC_MONETARY LC_NUMERIC LC_TIME"
Defaults env_keep += "LINES COLUMNS"
Defaults env_keep += "LSCOLORS"
Defaults env_keep += "SSH_AUTH_SOCK"
Defaults env_keep += "TZ"
Defaults env_keep += "DISPLAY XAUTHORIZATION XAUTHORITY"
Defaults env_keep += "EDITOR VISUAL"
Defaults env_keep += "HOME MAIL"
Defaults lecture_file = "/etc/sudo_lecture"
# Defaults passprompt = '[sudo] password for %p: '
#Defautls passprompt_override
export SUDO_PROMPT='[sudo] %p : '