Root sudo? (was Re: Cron Job Failure)

Allen Chen achen at harbourfrontcentre.com
Wed Apr 27 15:14:38 UTC 2005


Ed Wilts wrote:

>On Tue, Apr 26, 2005 at 05:28:20PM -0400, Allen Chen wrote:
>  
>
>>Mike Burger wrote:
>>
>>    
>>
>>>On Tue, April 26, 2005 12:50 pm, Allen Chen said:
>>>
>>>
>>>      
>>>
>>>>I got another problem with RedHat 9.  The sudo doesn't work any more
>>>>with root. It hangs. But it still works with other users.
>>>>
>>>>        
>>>>
>>>Realizing, up front, that this doesn't answer your question, I do have
>>>ask...why would you bother using sudo as root?  The whole point of sudo is
>>>to be able to run commands as root...if you're already root, why would you
>>>need to use sudo?
>>>
>>>      
>>>
>>I'm not using sudo with root. The problem is that the php script forks a 
>>process using sudo.
>>    
>>
>
>You stated above that sudo hangs when running as root.  Now you're
>saying that it hangs when run as nobody (or whatever your php script is
>running as).  Please describe exactly what the problem is you're having
>so that we can have some sort of clue as to how to help you.
>
>Do the symptoms change if you run the script interactively instead of
>from a web browser?
>  
>
My php script   exec("sudo /usr/local/bin/setpassword $uid $pass"); hangs,
so I did  #ps -ef |egrep 'nobody|sudo' and I get these:

> nobody   13526 13523  0 Apr15 ?        00:00:00 
> /usr/local/apache/bin/httpd -DSSL
> nobody   13527 13523  0 Apr15 ?        00:00:00 
> /usr/local/apache/bin/httpd -DSSL
> nobody   13528 13523  0 Apr15 ?        00:00:00 
> /usr/local/apache/bin/httpd -DSSL
> nobody   13636 13523  0 Apr15 ?        00:00:00 
> /usr/local/apache/bin/httpd -DSSL
> root     13914 13526  0 Apr15 ?        00:00:00 sudo 
> /usr/local/samba/bin/setpassword.exp aaa asdasd

I dont't know why the last line above is running as root. It should be 
nobody. Because apache is running as nobody.
The sudoer file has a line like     nobody  ALL= (ALL) NOPASSWD: ALL
and another line like  root    ALL= (ALL) ALL

So when I login as root and test sudo command, it hangs. Everything was 
fine before.
Also when I login as root and run command: strace sudo ls, it hangs at 
the last line below:

 _llseek(3, 0, [0], SEEK_SET)            = 0
setresuid32(0xffffffff, 0, 0xffffffff)  = 0
brk(0)                                  = 0x8066000
brk(0x8067000)                          = 0x8067000
brk(0)                                  = 0x8067000
brk(0x806b000)                          = 0x806b000
ioctl(3, SNDCTL_TMR_TIMEBASE, 0xbfffe250) = -1 ENOTTY (Inappropriate 
ioctl for device)
read(3, "# sudoers file.\n#\n# This file MU"..., 8192) = 690
read(3, "", 4096)                       = 0
read(3, "", 8192)                       = 0
ioctl(3, SNDCTL_TMR_TIMEBASE, 0xbfffe230) = -1 ENOTTY (Inappropriate 
ioctl for device)
close(3)                                = 0
munmap(0x40017000, 4096)                = 0
setresuid32(0, 0, 0)                    = 0
brk(0)                                  = 0x806b000
brk(0x806d000)                          = 0x806d000
time([1114614576])                      = 1114614576
rt_sigprocmask(SIG_SETMASK, NULL, [RTMIN], 8) = 0
rt_sigsuspend([]





More information about the redhat-list mailing list