• Sudo Insults


    Hello!
    Like any person, I want Sudo to insult me every time I get my password wrong. However, when trying to edit the sudoers file to add insult capability, I was unable to make a change that had any effect.

    Any ideas?

  • You don’t specify how did you do it. Si I simply demonstrate a polished way to do it.

    1. Editing sudoers file directly is considered as a bad practice. It’s better to add user modifications thru /etc/sudoers.d folder.

    2. Create a new file in /etc/sudoers.d. Name it like 10-myadditions. Mine is called 10-alexsudo:

      ┌──[just]@[alexarp]:~$
      └─> sudo ls -lha /etc/sudoers.d
      total 12K
      drwxr-x---  2 root root 4.0K Dec  2 15:16 .
      drwxr-xr-x 73 root root 4.0K Apr 26 10:40 ..
      -rw-r--r--  1 root root   69 Dec  2 15:15 10-alexsudo
      ┌──[just]@[alexarp]:~$
      └─> 
      
    3. Add to it any commands | instructions which you was adding by editing sudoers file. For example, mine contains:

      ┌──[just]@[alexarp]:~$
      └─> sudo cat /etc/sudoers.d/10-alexsudo
      Defaults pwfeedback
      Defaults insults
                                                                                                                          
      %wheel ALL=(ALL) NOPASSWD: ALL                                                                                      
      ┌──[just]@[alexarp]:~$                                                                                              
      └─>                                                                                                                 
      

      The command you’re interested in is Defaults insults.

    4. Creating /etc/sudoers.d/10-myadditions file has exactly the same effect as editing sudoers file directly.

    5. Logout-login

    6. Done

  • @just Thank you so much! I tried to use /etc/sudoers.d/10-myadditions but it said there was no such file or directory.

  • @moredoor said in Sudo Insults:

    …I tried to use /etc/sudoers.d/10-myadditions but it said there was no such file or directory.

    Sure the file doesn’t exist. It’s up to you to create it.

  • @just I’m sorry, I’m still a bit confused. I am able to execute the command

    sudo ls -1ha /etc/sudoers.d
    

    and it kindly gives me this:

    .
    ..
    10-installer
    

    Is this what I’m looking for? I tried it and nothing happened.

  • @moredoor It’s the file, created by Cnchi by default during the installation. Antergos devs have already added to it some commands, following the method, described above.

    You should either create your own, new file, or edit already existing file, the 10-installer. The 2nd choice may be easier for you. Just add Default insults to 10-installer.

  • @just you can tell how new I am at this :P

    sudo cat /etc/sudoers.d/10-installer 
    

    returns

    pluto ALL=(ALL) ALL
    

    What would be the command to do this?

    @just said in Sudo Insults:

    You should either create your own, new file, or edit already existing file, the 10-installer. The 2nd choice may be easier for you. Just add Default insults to 10-installer.

  • @moredoor Edit the existing 10-installer in a text editor, installed in your system:

    sudo <text-editor> /etc/sudoers.d/10-installer
    

    Replace <text-editor with the name of your text editor.

    Add Defaults insults anywhere you wish in the file. Save the file. Close the text editor. Done.

  • @just I’m really sorry, but it’s still saying no such file or directory. My text editor is called Text Editor.

  • @moredoor said in Sudo Insults:

    …My text editor is called Text Editor.

    No. It does not called Text Editor.

    What DE do you use?

  • @just I use Cinnamon

  • @moredoor

    sudo gedit /etc/sudoers.d/10-installer
    
  • @just

    (gedit:14649): GLib-GIO-CRITICAL **: g_dbus_proxy_new_sync: assertion 'G_IS_DBUS_CONNECTION (connection)' failed
    
    (gedit:14649): GLib-GIO-CRITICAL **: g_dbus_proxy_get_name_owner: assertion 'G_IS_DBUS_PROXY (proxy)' failed
    
    (gedit:14649): dconf-WARNING **: failed to commit changes to dconf: Error spawning command line 'dbus-launch --autolaunch=c19a1283c0a048968b90c0d01f6108b8 --binary-syntax --close-stderr': Child process exited with code 1
    
    (gedit:14649): dconf-WARNING **: failed to commit changes to dconf: Error spawning command line 'dbus-launch --autolaunch=c19a1283c0a048968b90c0d01f6108b8 --binary-syntax --close-stderr': Child process exited with code 1
    
    (gedit:14649): dconf-WARNING **: failed to commit changes to dconf: Error spawning command line 'dbus-launch --autolaunch=c19a1283c0a048968b90c0d01f6108b8 --binary-syntax --close-stderr': Child process exited with code 1
    
    (gedit:14649): dconf-WARNING **: failed to commit changes to dconf: Error spawning command line 'dbus-launch --autolaunch=c19a1283c0a048968b90c0d01f6108b8 --binary-syntax --close-stderr': Child process exited with code 1
    
    (gedit:14649): dconf-WARNING **: failed to commit changes to dconf: Error spawning command line 'dbus-launch --autolaunch=c19a1283c0a048968b90c0d01f6108b8 --binary-syntax --close-stderr': Child process exited with code 1
    
    ** (gedit:14649): WARNING **: Set document metadata failed: Setting attribute metadata::gedit-spell-language not supported
    
    
  • sudo dbus-launch gedit /etc/sudoers.d/10-installer
    

    Or

    • open nemo as root:
      sudo dbus-launch nemo
      
    • navigate to /etc/sudoers.d
    • click (or double click) on 10-installer to open it in gedit as root
    • modify the file as needed
    • save the file
    • close gedit
    • close nemo
    • logout-login
    • done
  • sudo: parse error in /etc/sudoers.d/10-installer near line 2
    sudo: no valid sudoers sources found, quitting
    sudo: unable to initialize policy plugin

  • @moredoor said in Sudo Insults:

    sudo: parse error in /etc/sudoers.d/10-installer near line 2

    Sudo checks the file for possible errors before saving it. A wrong sudoers-related file(s) seriously damage the system. File with error(s) is never saved.

    I assume that there’s an error somewhere in line 2 in the file you’re trying to save.

    I can’t help you further. Sorry.

  • @just Thank you so much. I’m sorry I wasn’t very quick with the uptake.

insults1 sudo12 Posts 17Views 747
Log in to reply