Why sudo included in the cron job is not working as expected in Red Hat Enterprise Linux 7 ?

Solution Unverified - Updated -

Issue

  • Why sudo included in the cron job is not working as expected in Red Hat Enterprise Linux 7 ?

    Example: Cron job configured for a non root user

    5 15 * * *  sudo docker exec  rhel7 sh -c "ps aux"  
    

    The following error occurs in cron job including sudo:

    sudo: sorry, you must have a tty to run sudo
    

Environment

  • Red Hat Enterprise Linux 7
  • Sudo configured for non root users

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