> ## Content Index
> Fetch the complete content index at: https://snubmonkey.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Customize Linux sudo Error Messages with Insults.
- URL: https://snubmonkey.com/customize-sudo-error-messages-linux/
- Published: 2023-07-30T23:20:20.000Z
- Updated: 2026-10-16T22:21:14.000Z
- Description: Customize Linux sudo error messages with playful insults or a personalized response. Learn how to enable Defaults insults and configure badpass_message safely using visudo.
- Author: yannick Coffi
- Tags: how to 🪄, linux 🐧, tips

# 

By default, `sudo` displays a simple error message when you enter an incorrect password:

```
$ sudo apt update
[sudo] password for monkey:
Sorry, try again.
```

Functional? Absolutely. 

If you prefer a little humor in your terminal, you can configure `sudo` to respond with random insults whenever you enter an incorrect password. Alternatively, you can replace the default error message with one of your own.

Let's explore both options.  

## 1\. Enable Random Insults with `Defaults insults`

The `sudoers` configuration controls how `sudo` authorizes users and handles privileged command execution. One of its built-in options, `insults`, replaces the usual incorrect-password response with a randomly selected insult.

To enable it, edit the sudoers configuration using `visudo`.

**Important:** Always use `visudo` to modify the sudoers configuration. It validates the syntax before saving changes, helping prevent configuration errors that could lock you out of administrative access.

### Step 1: Open the sudoers file

```
$ sudo visudo
```

### Step 2: Enable insults

Add the following directive to the defaults section:

```
Defaults insults
```

Your configuration might look something like this:

```
#
# This file MUST be edited with the 'visudo' command as root.
#

Defaults        env_reset
Defaults        mail_badpass
Defaults        secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"

Defaults        insults

# Host alias specification
# User alias specification
# Cmnd alias specification
```

The existing configuration will vary by distribution. **Do not replace your entire sudoers file with this example.** Simply add the directive to your existing configuration.

Save and exit your editor.

### Step 3: Test the configuration

The next time you deliberately enter an incorrect password, `sudo` may respond with a randomly selected insult instead of its usual message.

For example:

```
[sudo] password for monkey:
I fart in your general direction!
```

Other possible responses include:

```
When you're walking home tonight, and some homicidal maniac comes after you with a bunch of loganberries, don't come crying to me!
```

```
There's nothing wrong with you that an expensive operation can't prolong.
```

```
What, what, what, what, what, what, what, what, what, what?
```

```
Maybe if you used more than just two fingers...
```

The exact messages depend on the installed sudo version and its available insult database.

## 2\. Customize the Incorrect-Password Message

If random insults aren't your thing, you can configure `sudo` to display a custom message whenever a user enters an incorrect password.

The `badpass_message` option allows you to replace the default *Sorry, try again.* response with your own text.

### Step 1: Open the sudoers configuration

```
$ sudo visudo
```

### Step 2: Define your custom message

Add the following directive:

```
Defaults badpass_message="Oops! That's the wrong password. Try again."
```

You can replace the message with anything you prefer, provided it is valid sudoers syntax.

For example:

```
Defaults badpass_message="Access denied, monkey. Check your password!"
```

Or, if you prefer something more professional:

```
Defaults badpass_message="Authentication failed. Please try again."
```

Save and exit the editor.

### Step 3: Test your changes

Run a command that requires elevated privileges:

```
$ sudo apt update
```

Enter an incorrect password to see your customized response.

For example:

```
[sudo] password for monkey:
Access denied, monkey. Check your password!
```

The custom message replaces the default incorrect-password response.

**Note:** The `badpass_message` option is supported by modern sudo versions, but availability may vary on older installations. Consult `sudoers(5)` if the option is rejected.

## 3\. Can You Enable Both Options?

Yes. You can define both directives in the sudoers configuration:

```
Defaults insults
Defaults badpass_message="Nice try, monkey. Wrong password!"
```

However, **do not assume both settings will produce their respective messages simultaneously**. Their interaction depends on the installed sudo version and its implementation.

When both options are enabled, test the behavior on your system to determine which incorrect-password response takes precedence.

For predictable results, choose one option:

- **`Defaults insults`** — for randomly selected insults.
- **`Defaults badpass_message="..."`** — for a consistent, personalized message.

## 

  
Customizing `sudo` error messages is a simple way to add personality to your Linux terminal. With `Defaults insults`, an incorrect password can trigger a random insult. With `badpass_message`, you can replace the default response with your own text.

**Remember**: Always use `visudo` to edit the sudoers configuration, and keep your system's security settings intact—even when having fun with the command line.

We hope you found these tips useful.