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

Solution Verified - Updated -

Issue

  • /etc/sudoers file does not accept special characters such as: !, =, :, ,, (, ), \ in /etc/sudoers configuration file.

  • For example, below /etc/sudoers configuration entry gives a 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, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content