Ah ah ah You didn’t say the magic word

We sudoers love our omnipresence and omniscience, but there is one problem. Don’t you hate it when you command to install a “sudo apt-get update” or a “sudo rm -rf /” it just tells you:

~: sudo rm -rf /

[sudo] password for lahat:

What is that! it is boring and undermines the entire point of using the infinitely configurable Linux.

How about something more classy:

You can do that, there is a -p option to sudo.

so if you do:

~: sudo -p “Ah ah ah, you didnt say the magic word: “‘ rm -rf /

Ah ah ah, you didnt say the magic word:

That is an improvement but it is a bit tricky to write every time you need a sudo command.

Good thing we have aliases, just add an alias to your .bashrc or .alias:

alias sudo=’sudo -p “Ah ah ah, didnt say the magic word: “‘

DONE. now every sudo will greet you however you please.

 

Edit:

I like to thank /u/ibenchpressakeyboard for suggesting the proper method for doing this. You ideally edit your sudoers file. In order to access it you need to use this command:

sudo visudo

(the command is visudo buy you need sudo permission to edit)

and add this line:

Defaults passprompt="your prompt "

This is the proper way of changing your prompt.

Careful sudoing

 

Extra:

If you the alias method, you can insert commands in it:

alias sudo=’sudo -p “$(shuf ~/.prompts -n 1)” ‘

This will choose a random line of file called ‘.prompts’ your home directory and use it as a prompt, this way you can add more than one insightful statement to before gaining superpowers. As /u/DoesntSmellRight pointed me; you shouldn’t worry  if you have quotation characters in your ‘.prompts’ file as they won’t escape.

Good ‘.prompts’ quotes:

With great power comes great responsability:

Ah ah ah, you didnt say the magic word:

Ye be warned:

Sudo make sandwich:

 

 

 

Pin on Pinterest0Buffer this pageEmail this to someoneShare on Facebook0Share on Google+0Flattr the authorDigg thisPrint this pageTweet about this on TwitterShare on LinkedIn0Share on Reddit0Share on StumbleUpon0Share on Tumblr0

Leave a Reply