Skip to main content

How to personalize the fancy warning message of sudo

2 min read

Heya, it's 10-11-12 or 10/11/12. You and I, we going to be a part of history.
When the date will comeback again we will be history ourselves! :P
So enjoy it!

Today I am going to post a follow up on my previous post How to keep the fancy warning message of sudo forever.
On that post I wrote about how to enable the warning message forever when using sudo. Now I'm going to write about how the change the warning message and personalize it on your own.

It's so simple. Just create a file called lecture inside /etc/sudoers.d/. You can use the command below.
[code type=bash]sudo touch /etc/sudoers.d/lecture[/code]
Now edit the file with your favorite text editor in root mode and write your own warning message. Mine is nano.
[code type=bash]sudo nano /etc/sudoers.d/lecture[/code]
Finally we will have to edit the file we have created on the previous post to enable the custom warning message option.
[code type=bash]sudo nano /etc/sudoers.d/local.conf[/code]
Append the below line at the end of the file:
[code type=bash]Defaults lecture_file = /etc/sudoers.d/lecture[/code]
Voila, You are done. Close your Terminals and reopen it.
Now try to do something with sudo and you will see the warning message of your own.

Enough for today. You guys enjoy the 10-11-12. Also don't forget to tell how the tips is and what do you think about this type of fancy things!