Bug 213207 - sudo -u can not be run from cron job
sudo -u can not be run from cron job
Status: CLOSED NOTABUG
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: sudo (Show other bugs)
5.0
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Peter Vrabec
Ben Levenson
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2006-10-31 03:09 EST by ilja lunev
Modified: 2007-11-30 17:07 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-11-01 10:52:17 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description ilja lunev 2006-10-31 03:09:46 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.7) Gecko/20060909 Firefox/1.5.0.7

Description of problem:
sudo -u {user}  can not be run from cron jobs anymore with 
2.6.17-1.2519.4.21.el5xen  Red Hat Enterprise Linux Client release 4.91 (Tikanga) 
 
Error message is> root : sorry, you must have a tty to run sudo 
 
It is essential that root can monitor security related files (like .ssh/authorized_keys) for users which have nfs mounted home directories. 
With Redhat 3 and 4 there was no problem to schedule something like:  
sudo -u $User cat /home/$User/.ssh/authorized_keys

Version-Release number of selected component (if applicable):
sudo-1.6.8p12-7

How reproducible:
Always


Steps to Reproduce:
1. build a cron job which tries to run "sudo -u AnyUser ls /home/AnyUser"
2.
3.

Actual Results:
/var/log/secure shows "root : sorry, you must have a tty to run sudo"
and the cron job does not give the desired output

Expected Results:
/var/log/secure should show>
sudo:     root : TTY=unknown ; PWD=/root ; USER=AnyUser ; COMMAND=/bin/ls /home/AnyUser

and the cron job gives a listing of AnyUser's home directory

Additional info:
Comment 2 Peter Vrabec 2006-11-01 10:52:17 EST
It's because "Defaults requiretty" is specified in /etc/sudoers file. 

Note You need to log in before you can comment on or make changes to this bug.