How to handle special characters in /etc/sudoers file ?

Solution Verified - Updated -

Issue

  • /etc/sudoers file does not accept special character such as: *, ?, [, ], : in /etc/sudoers configuration file.

  • For example, below /etc/sudoers configuration entry gives syntax error while modifying it with visudo

    admin  ALL=(ALL)  NOPASSWD: /path/to/app IsAlive module\:All instance:iv1
    
  • Expected error in case of special character usage without escape.

    visudo
    >>> /etc/sudoers: syntax error near line 114 <<<
    What now? 
    Options are:
      (e)dit sudoers file again
      e(x)it without saving changes to sudoers file
      (Q)uit and save changes to sudoers file (DANGER!)
    

Environment

  • Red Hat Enterprise Linux (RHEL): All supported versions.

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.