0

How can I change [sudo] password for $USER to more macOS style Password: ?

1

Like this?

sudo -p "Custom prompt:" ls
Custom prompt:

Edit: As steeldriver commented:

"For completeness, you might want to mention the SUDO_PROMPT environment variable (which allows a user to set the prompt persistently) and the sudoers configuration file parameter passprompt that allows administrators to customize it system-wide."

so, to do that;

export SUDO_PROMPT="Custom Prompt"
sudo su
Custom Prompt

Edit3: To -revert- the action; use the unset command:

unset <env variable>

for example, unset $SUDO_PROMPT:

unset SUDO_PROMPT
  • 1
    Rather unclear question, but OP means the prompt you get asking you for your sudo password, i.e. right after you typed "sudo <command>". – vanadium Oct 8 '20 at 11:40
  • 1
    For completeness, you might want to mention the SUDO_PROMPT environment variable (which allows a user to set the prompt persistently) and the sudoers configuration file parameter passprompt that allows administrators to customize it system-wide. – steeldriver Oct 8 '20 at 11:50
  • Yeah, you're right, thought about using it right now! Nice there – William Martens Oct 8 '20 at 11:54
  • 1
    Nice I did ittt – user1131557 Oct 8 '20 at 12:43
  • 1
    I added export SUDO_PROMPT=Password: " at end of .zshrc file. – user1131557 Oct 8 '20 at 12:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy