Re: `ls -l /` does not reproduce same info than when executed in bash.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Richard Lynch wrote:
BASH -------------------------------------------------------
lrwxrwxrwx    1 root    root      28 Mar  3 07:25 app ->
/afs/sunrise.ericsson.se/app
drwxr-xr-x    2 root    root       0 Mar  7 13:06 apps
lrwxrwxrwx    1 root    root      24 Mar  7 14:11 archives ->


PHP --------------------------------------------------------
?---------    ? ?        ?          ?            ? app
?---------    ? ?        ?          ?            ? apps


WILD GUESSES

#1 (benign)
Your 'apache' user on the bad box has some kind of cool shell color-coding
going on.

The color-coding puts out control characters for directories, users,
permissions, and masks weird-o characters in filenames.

Those control characters, when presented to you in a browser/text rather
than a shell context, show up as funky-ass things like ? and that
diamond-shaped inverse ? thing.

You can diagnose this pretty easily, really.

When you su to apache on the bad box and do "ls -ld /" do you get all
kinds of pretty colors and stuff?  Well, there ya go.  Make it not do
that.

You're on your own figuring out how to do that.  To me, it's just some
magic that's sometimes on some Un*x boxes, and sometimes not, and that's
how life goes. :-) [I don't care enough either way about the color-coding
to find out, much less remember, how to change it either way.]

#2 (panic)
EXTREMELY UNLIKELY:
You've been hacked and the 'ls' binary has been replaced with something
that does something else very weird, but you don't see it under shell
conditions...
#1 is almost for sure the real answer...
But if it's #2, you'd better act carefully.

Hi Richard.


Although "ls -ld /" returns some color, that is not the problem. I tried within PHP `ls --color=never -ld /` and it fails to. ls is not the only command having problems. I tried other commands like `find /lmw -name '*'` and `cd /lmw` and they fail because of bad permissions.


Could it be because of SELinux? I wonder. I think that Apache runs under some SELinux restrictions and that might be the problem. I will investigate and report on this.


Ciao, Hans Deragon -- Consultant en informatique/Software Consultant Deragon Informatique inc. Open source: http://www.deragon.biz http://facil.qc.ca (Promotion du libre) mailto://hans@xxxxxxxxxxx http://autopoweroff.deragon.biz (Logiciel)

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux