Re: HELP!
| From: | Richard Lynch | Date: | Wed, 03 Oct 2001 04:12:54 +0000 |
| Subject: | Re: HELP! | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-69690@lists.php.net to get a copy of this message | ||
"nobody" can't su to a real user without their password, and su requires a
REAL TTY to get in a password, almost for sure, and you just can't do it
that way...
Make a nobody-executable shell script to do grabdb...
Be aware that then anybody on your server can do grabdb whenever they
want...
--
WARNING richard@zend.com address is an endangered species -- Use
ceo@l-i-e.com
Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
----- Original Message -----
From: Armando Cerna <armando@thefoodlist.com>
Newsgroups: php.general,php.db
To: <php-general@lists.php.net>
Cc: <php-db@lists.php.net>
Sent: Tuesday, October 02, 2001 9:07 PM
Subject: HELP!
> I have the following script does anyone see anything wrong with this as
to
> why it wouldn't be working
>
> It should su to mp then execute the command but I may have missed
something
> is \n ok for a carrige return? I did it like this because as nobody the
> command couldn't be executed and failed and it won't let me su to nobody.
> Well anyway here is the script
>
> <?PHP
>
> $permission = popen ("su mp -c grabdb","w+");
> sleep(2);
> fwrite($permission,"secret\n");
> pclose($permission);
>
> if ($permission) {
> print "All done Sir. Shall I <a href=index.html>return</a> you?";
>
> } else {
> print "$files";
> print "It's ok you'll get it working. =)";
> }
>
>
>
> ?>
>
>
> It calls the bash script grabdb which contains the following:
>
> updatemp ; importmp ; echo "All Complete Sir"
>
>
> Now updatetemp contains the following
>
>
> smbclient file://machine/c -I 192.168.0.4 -U armando%secret -D a1 -c 'lcd
/tmp/dbf
> ; prompt ; mget cus.dbf ; quit'
>
>
>
> Once that is done it moves on to importmp
>
> cd /tmp/dbf ; dbf2mysql -d maria -t customers -s ID=row_id -c -P secret-U
> user CUS.DBF
>
> And then quits. Now mind you this works beautiful in a shell on its own
but
> once PHP tries to do it with the script mentioned above it doesn't work
>
>
> Thanks for any help,
> Armando
>
>