|
Posted by Erwin Moller on July 23, 2008, 1:11 pm
Please log in for more thread options lawrence k schreef:
> On Jul 11, 4:26 am, Erwin Moller
>> LawrenceKrubnerschreef:
>>
>>
>>
>>> I've a PHP script that is run as a cron job. It contains this line:
>>> $stringListingAllProcesses = shell_exec("lsof | grep vsftpd");
>>> The lsof command returns almost nothing unless you are the root user.
>>> Can anyone think of a way I can use su or sudo or something else to get
>>> this script to run as root?
>>> (And yes, I'm aware that it is dangerous to allow a PHP script to run as
>>> root, but it is in an otherwise secure environment, far removed from the
>>> web.)
>> Hi,
>>
>> The easiest way is to make a cronjob for root.
>> Just go root and crontab it.
>>
>> If you have no rootaccess, you cannot run as root of course....
>
>
> That is what I tried first. I logged in as root and did "crontab -e".
> But the script doesn't seem to run as root. The lsof in the script
> seems to run as... I don't know who. It returns no data, which would
> make sense for a non-root user.
>
Hi,
Roor user should be able to run that command just fine.
Are you sure you simply don't have a process named 'vsftpd'?
What does this produce:
$stringListingAllProcesses = shell_exec("lsof");
Also nothing???
Regards,
Erwin Moller
|