[HowTo] have Manjaro insult you whenever you do something dumb

Difficulty: ★★★☆☆

Have sudo insult you:

Whenever you use sudo and typing the wrong password, you can have the sudo application insult you:

$ sudo ls /
[sudo] password for fab-user: 
Hold it up to the light --- not a brain in sight!
[sudo] password for fab-user: 
It can only be attributed to human error.
[sudo] password for fab-user: 
sudo: 3 incorrect password attempts
  • To activate this feature:

    sudo visudo
  • At the end of the file before the #includedir /etc/sudoers.d type:

    Defaults insults
  • save and quit

  • Done!

Have any wrongly typed command insult you

(Credits @chomsky and hbakke, the author of this package)

  • Execute:

    pamac install bash-zsh-insulter
  • Add the following to /etc/bash.bashrc or any of the other locations where you can configure your shell automatically during login:

    if [ -f /etc/bash.command-not-found ]; then
        . /etc/bash.command-not-found
  • exit the terminal

  • open the terminal again

  • try it out

    $ cdd /home
      Your application for reduced salary has been sent!
    /bin/bash: cdd: command not found
    $ oops
      What if I told you... it is possible to type valid commands.
    /bin/bash: oops: command not found
    $ lf
      Fake it till you make it!
    /bin/bash: lf: command not found

P.S. 3★ difficulty because we’re changing the sudoers file here and if done incorrectly, no more sudo for you!!! :man_shrugging:


I thought the standard way was to use sudoedit? :man_shrugging:/:woman_shrugging:
Anyhow :+1::wink:

You can also install bash-zsh-insulter if you like being insulted with every wrong command you type in the terminal.

1 Like

Better it is moving changes in /etc/sudoers to separated files in /etc/sudoers.d dir. Add @includedir /etc/sudoers.d

1 Like

The line was commented by a @ and after uncommenting I got the following error:

/etc/sudoers:96: syntax error, unexpected COMMAND
includedir /etc/sudoers.d

What makes it even weirder is that I do have the following changes in a custom conf:

[manjaro sudoers.d]# cat 20-chomsky
Defaults	insults
Defaults	timestamp_timeout=20
Defaults	timestamp_type=global

Everything is working as it should though. Any thoughts on the @…?

it’s actually not a “comment”…

it’s how it have to be
@includedir .....

1 Like

Ah I see, thanks for the reply.

sudoedit or sudo -e is standard for whenever you are making a system file edit.
except for editing sudoers
The funny thing is … its partially because visudo works a bit like sudoedit that you should.
But it does a little more - it wont allow you to create a malformed sudoers file.



I didn’t know that this existed. I love it so much!

1 Like

Also you have package sl
Which will give you a choo-choo whenever you mistype ls

(PS … also package bash-zsh-insulter in AUR)

:sweat_smile:. +1 to have this as default setting in all Manjaro editions

1 Like

While were at it…

1 Like

Ahhh yes indeed you’re right: Configure sudo using drop-in files in /etc/sudoers.d

How would one fix this? What happens when you do that (not having the Defaults insults at the proper place)? I guess to fix it you would use command su then modify the sudoers file with visudo?

Actually the best place to put that “directive” is in a separate config piece under /etc/sudoers.d, eg. like /etc/sudoers.d/00_insults
When you use visudo it won’t allow you to make mistakes that render sudo to error-out due to syntax errors.
But mistakes in functionality can always happen and the last resort would be to boot with single kernel option to drop to a root shell on boot and fix stuff from there on…

My advice would be to never modify the /etc/sudoers file, but instead always work with separate config pieces under /etc/sudoers.d

1 Like

You’d have to boot a Manjaro USB, chroot and overwrite your messed up version with the original but with visudo that’s very unlikely (though not 0)


1 Like

I messed up I was unable to have sudo privilege again (I could su - and visudo, then I removed the Defaults insult line, rebooted but no sudo for me despite the sudoers file back to its previous state, so I Timeshifted from a month old backup), but that is maybe because I have previously modified the sudoers file and have a line at the bottom to be able to execute some commands with sudo without password maybe, I don’t know, this is what I have at the very bottom of my sudoers file:

omano ALL= NOPASSWD: /usr/bin/command1, /usr/bin/command2, /usr/bin/command3

So two question, is it right to have placed this line at the very bottom? Should I move it somewhere else?

I’m not sure what would be the best thing to do. I’ll do another Timeshift backup now I have restored the system from previous backup and upgraded everything again, I think I might do the other approach and use the external file to add this as TriMoon suggested.

//EDIT: TriMoon suggestion worked like a charm, I don’t know why I messed up before, I think my line at the very bottom of sudoers file might be the culprit.