Bug? Bash [ -x <file> ] always returns true as root

Hi everybody,

I got recently aware of a strange behavior under bash as root: file operation -x always return true, no matter what. Could not find anything related in this forum.

For instance:
Code:
# touch foo && chmod a-x foo && [ -x foo ] && echo "Foo is executable." && rm foo
Foo is excutable[/I]

I cannot believe this could be a feature. Then is it a bug?

Code:
# bash --version
GNU bash, version 4.1.7(0)-release (i386-portbld-freebsd8.1)

Code:
# uname -v
FreeBSD 8.1-STABLE #0: Sun Oct 31 15:06:27 CET 2010     root@:/usr/obj/usr/src/sys/GENERIC

Some ideas?

Cheers
Franck
 
I'm sorry, but not quite sure about what you really mean with your statement. So, no I did not trade my favorite root shell (bash) in /etc/passwd for /usr/bin/true ;), and no I did not write my own root shell (I love Bash as it is).

Anyway, one fellow answered and put me on the right track regarding this apparently known issue, still to be investigated on my side. Thanks all you guys for your (precious) time. I will post when I get a definite working way around this annoying problem.

Season greetings to all
Cheers.

Franck
 
franck-porcher said:
I'm sorry, but not quite sure about what you really mean with your statement. So, no I did not trade my favorite root shell (bash) in /etc/passwd for /usr/bin/true ;), and no I did not write my own root shell (I love Bash as it is).
Don't change root's shell, leave it set to /bin/csh.
 
SirDice said:
Don't change root's shell, leave it set to /bin/csh.

And to complete this argument. If your systems fails for some reason, and you have changed the root-shell, you might not be able to easily access your system. This is a pain in the neck, and has bitten several users. For that reason only use the standard shell for root. If you _desperately_ need to use a shell as root, which you should think about doing anyway, it is better to start a new shell once you are logged in.
 
Back
Top