audrey xie
not a jack of all trades, nor a master of one. i prefer just being a lazy bum.
← posts

Sudowoodo reminding you to be careful when using sudo

Remember the lecture that you recieved when you first used sudo?

We trust you have recieved 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.

It’s a pretty nice warning and I think it’s quite unfortunate that it only appears once. Luckily, there’s a way to make it permanent. Simply open the sudoers file and in the Defaults section set the lecture to always.

# open the sudoers file using
sudo visudo

# under defaults add
Defaults    lecture=always

And congrats, the message now appears every time.

But wait, there’s more! You can take it one step further by setting a custom lecture. I thought it would be clever to display an ascii image of sudowoodo, the rock type pokemon that looks like a tree, because it’s SUDOwoodo (haha, get it?).

So make a new file with whatever message you want displayed and set the lecture_file to wherever the file is (my file was located at /etc/sudoers.lecture).

You can find the ascii sudowoodo here.

# open the sudoers file
sudo visudo

# under defaults add (replace the path with your own)
Defaults    lecture_file=/etc/sudoers.lecture

And congrats again, you now have a custom sudo message.