[Top][All Lists]

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

Re: can we remove a directory from within that directory??

From: Phillip Susi
Subject: Re: can we remove a directory from within that directory??
Date: Mon, 21 Nov 2005 11:05:43 -0500
User-agent: Thunderbird 1.5 (Windows/20051025)

It is a general design philosophy of linux, and unix in general, that the kernel will not enforce locking of files. This is why you can upgrade software without rebooting: the old file can be deleted and replaced with the new file, even though it is still in use. Of course, it isn't actually deleted until everyone using it closes it, but it's name is removed from the directory tree immediately.

If you really want to mess up a system, you can rm -fr / ( as root of course ) and it will happily delete all the files on the system. Whatever is running at the time will keep running, but new opens will fail. This behavior is pretty much by design.

kuldeep vyas wrote:
[input] [input] [input] [input] Hi,

I'm using Redhat 9 (kernel 2.4.20-8 on i686)
I logged in as k(username), then I started terminal, &
then I gave following commands:-


k>mkdir my_dir
  // i created a directory: my_dir

k>cd my_dir
  // let's go in my_dir

// now let's try to remove my_dir
k>rmdir /home/k/my_dir
  // no error;

k>ls /home/k/
// my_dir gone
  // oops!!

  // let's create my_file here!!
k>cat >my_file
bash: my_file: no such file or directory
  // I'm not allowed to a create file here.

pwd says I'm in my_dir, but my_dir doesn't exist.
I think: user should not be allowed to remove a directory,
until & unless he is placed in a directory which is hierarchically above the one he has chosen to remove.

If my approach is not right, I'd like to know the philosophy behind this.

Happy contributing to LINUX!!

kuldeep vyas

reply via email to

[Prev in Thread] Current Thread [Next in Thread]