15

Sudowoodo reminding you to be careful when using sudo

 4 years ago
source link: https://audreyxie.com/2020/sudowoodo-reminding-you-to-be-careful-when-using-sudo/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

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.

sudo_lecture.png

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?).

sudowoodo.png

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.

sudowoodo_term.png

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK