[Top][All Lists]

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

Re: chown and bash trashed part of system

From: Bob Proulx
Subject: Re: chown and bash trashed part of system
Date: Wed, 31 Dec 2008 00:28:54 -0700
User-agent: Mutt/1.5.13 (2006-08-11)

Vincent Chapman wrote:
> $ sudo chown -R vincent:vincent * 

When using -R and other commands in recursive mode you generally don't
want to use '*'.  Simply use '.' in that case.

  sudo chown -R vincent:vincent .

The command will recurse down '.' directory and do what you wanted.
That would have included all files hidden and otherwise.

Personally I prefer find in this case.

  find . -exec chown vincent:vincent {} +

> changed all but the hidden folders, so did not work for this situation
> $ sudo chown -R vincent:vincent .*  
> Command very bad.  
> ...
> Luckily I only messed up three user home directories.  Should there be a
> filter for '..' that prohibts chown from assending towards / ?

Have you ever used a kitchen knife?  I can't imagine a kitchen without
one.  Have you ever cut yourself while using a kitchen knife?  We all
have at one time or another.  The classic thought experiment (IIRC by
Andrew Koenig) is to design a kitchen knife that will make it
impossible to hurt yourself while using it.  After having thought
about the problem and created a design the follow-up question is,
would you use such a knife in the kitchen yourself?

This is a useful thought experiment that always comes to my mind when
people try to make it impossible to do bad things because that also
tends to restrict people from doing good things too.


reply via email to

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