Skip to main content

How to keep the fancy warning message of sudo forever

2 min read

You may have noticed the warning message while using sudo for the first time on Linux.
The warning message is something like this:

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.</pre>

I think it's fancy to keep the waring message not only for the first time but for all the time, and surely I like it.
You may also want to keep it if you have multiple users on your computer or server. Or even being a single fancy user like mine. ;)

Okay, I will show you how to keep the message forever on your Terminal while executing any sudo command.

Let's start. Create a file named local.conf inside /etc/sudoers.d/ of your Linux machine. You can use the command bellow to do that:

sudo touch /etc/sudoers.d/local.conf

Now open this file (/etc/sudoers.d/local.conf) with your preferred text editor in root mode. I use nano.
sudo nano /etc/sudoers.d/local.conf

Append this line into the file.
Defaults        lecture = always

Save the file. Close your Terminals and reopen it.
Now try to do something with sudo.

I will post how to edit the warning message next.
Till then let us know via comment what do you think about this type of fancy things!

Update 10-12-12:
Wrote the follow up post: How to personalize the fancy warning message of sudo.