[Ilugc] One Day One GNU/Linux Command (RM)

  • From: kapil@xxxxxxxxxxx (Kapil Hari Paranjape)
  • Date: Mon Jun 23 13:58:53 2008

Hello,

On Fri, 20 Jun 2008, Kapil Hari Paranjape wrote:

Apropos "rm -rf /".

On Fri, 20 Jun 2008, Arun Khan wrote:
Seriously, has anyone tried it?

I recall doing this once with user-mode-linux but didn't record the
session. You may want to try it with u-m-l or with qemu. It hurts
less when you play in the sand. :-)

You can try this instructive experiment yourself.

Here is the list of commands:
 1. aptitude install qemu
 2. wget http://bellard.org/qemu/linux-0.2.img.bz2
 3. bzcat linux-0.2.img.bz2 > test.img
 4. qemu test.img
This opens a window with the emulator running in it.

In that window you can type
        rm -rf /

The system complains a bit about not being able to remove
some directories like /dev/pts, /proc/asound etc.

You are returned to the command prompt since the shell 
is a running process.

At this point you need to kill qemu externally.

You can use qemu-img to then examine what files are left in test.img

Regards,

Kapil.
--

Other related posts: