on Fri, Oct 24, 2003 at 03:28:36PM +0100, Colin Watson (cjwatson@debian.org) wrote:
> On Fri, Oct 24, 2003 at 11:36:25PM +0930, David Purton wrote:
> > Sadly no, I neglected to say that I could not get things to work even
> > using a test account and doing an rm -rf .* in $HOME.
>
> Just in case other people try this, 'rm -rf .*' is VERY DANGEROUS. '.*'
> expands to include '.' and '..', and if you happen to have privileges to
> write to the parent directory then you'll end up removing all
> directories *next* to your current directory as well!
So what do folks do?
rm -rf .?* # will expand to include ..
rm -rf .[^.]* # seems right.
find . -depth -print0 | xargs rm # Usually works.
If you're really paranoid:
chown -r peon .
su -c 'rm -rf .' peon
...which first changes ownership to a nonprivileged user, then runs the
rm as that user. Keeps you from mucking things up in a rootly way.
Personally I tend to walk through trees very carefully when doing
deletes.
Other tips?
Peace.
--
Karsten M. Self <kmself@ix.netcom.com> http://kmself.home.netcom.com/
What Part of "Gestalt" don't you understand?
This sig for rent: a Signify v1.10 production from http://www.debian.org/
Attachment:
signature.asc
Description: Digital signature