Re: php exec()
| From: | Ashley Sheridan | Date: | Mon, 03 Nov 2008 07:29:04 +0000 |
| Subject: | Re: php exec() | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-282780@lists.php.net to get a copy of this message | ||
On Mon, 2008-11-03 at 15:21 +0800, cheesiong wrote:
> hi Chris,
> i found out that when execute ipkg, the return is before the header.
>
> root [ /srv/www/test ]# /program/php-5.2.6/bin/php-cgi ipkg.php
> ipkg version 0.99.163
> X-Powered-By: PHP/5.2.6
> Content-type: text/html
>
> Array
> (
> )
>
>
> which is different than the whoami program.
> root [ /srv/www/test ]# /program/php-5.2.6/bin/php-cgi whoami.php
> X-Powered-By: PHP/5.2.6
> Content-type: text/html
>
> the result of execwhoami is
> root
>
>
> can you see the different?
>
> regards,-keo
>
>
> On Mon, Nov 3, 2008 at 2:12 PM, cheesiong <bluecolour.sz@gmail.com> wrote:
>
> > hi Chris,
> > i did try,
> > below is the continouos output from prompt when i do su.
> >
> > root [ /srv/www/test ]# su daemon
> > root [ /srv/www/test ]#
> >
> > i didnt manage to switch user.
> > i will create an user... so that i can switch to it.
> >
> > i created a user call lfs into group lfs.
> > able to execute ipkg-cl and /program/..../ipkg-ck --version.
> >
> > then i change the httpd.conf to start apache with lfs and execute the php
> > script to exec ipkg-cl --version.
> > basically it is not working.
> >
> > root [ /srv/www/test ]# groupadd lfs
> > root [ /srv/www/test ]# useradd -s /bin/bash -g lfs -m -k /dev/null lfs
> > root [ /srv/www/test ]# passwd lfs
> > Changing password for lfs
> > Enter the new password (minimum of 5, maximum of 127 characters)
> > Please use a combination of upper and lower case letters and numbers.
> > New password:
> > Bad password: too short.
> > Warning: weak password (enter it again to use it anyway).
> > New password:
> > Re-enter new password:
> > Password changed.
> > root [ /srv/www/test ]# su lfs
> > bash-3.2$ ipkg-cl --version
> > ipkg version 0.99.163
> > bash-3.2$ /program/ipkg-0.99.163/bin/ipkg-cl --version
> > ipkg version 0.99.163
> > bash-3.2$
> >
> > lfs 13615 0.0 0.3 3684 1344 ? S 14:06 0:00
> > /program/httpd-2.2.9/bin/
> > lfs 13616 0.0 0.3 3684 1344 ? S 14:06 0:00
> > /program/httpd-2.2.9/bin/
> > lfs 13617 0.0 0.3 3684 1344 ? S 14:06 0:00
> > /program/httpd-2.2.9/bin/
> > lfs 13618 0.0 0.3 3684 1344 ? S 14:06 0:00
> > /program/httpd-2.2.9/bin/
> > lfs 13619 0.0 0.3 3684 1344 ? S 14:06 0:00
> > /program/httpd-2.2.9/bin/
> >
> >
> > so not the user right problem, am i right ?
> >
> > regards,-keo
> >
> >
> > On Mon, Nov 3, 2008 at 1:59 PM, Chris <dmagick@gmail.com> wrote:
> >
> >> cheesiong wrote:
> >>
> >>> hi Chris,
> >>> my linux system is LFS that i build from scratch.
> >>> i cant su to daemon.
> >>>
> >>> below is my /etc/passwd:
> >>> root [ /srv/www/test ]# cat /etc/passwd
> >>> root:x:0:0:root:/root:/bin/bash
> >>> nobody:x:99:99:Unprivileged User:/dev/null:/bin/false
> >>> sshd:x:50:50:sshd PrivSep:/var/lib/sshd:/bin/false
> >>> daemon:x:6:6:daemon:/dev/null:/bin/false
> >>>
> >>
> >> Change it, su, change it back. Looking at apache logs won't tell you much
> >> if you don't try something.
> >>
> >> Are you running selinux?
> >>
> >> <http://169.254.0.20>]
> >> /opt/ipkg-0.99.163/bin/ipkg-cl: Permission
> >>> denied, referer: http://169.254.0.101/test/
> >>>
> >>
> >> That one's pretty easy.
> >>
> >>
> >> --
> >> Postgresql & php tutorials
> >> http://www.designmagick.com/
> >>
> >>
> >
What about making an exec call, but piping the results of that call to a
text file. That way, it will be in a file that is easily accessed from
other parts of your site. I'm not sure which is more expensive, a call
to ifconfig, or a file read.
Ash
www.ashleysheridan.co.uk