Help avoiding .* problems

Kurt Wall kwall
Mon May 17 11:44:11 PDT 2004


Feigning erudition, Tom Condon wrote:
% 
% Yup.  Shot myself in the foot again.
% 
% Some versions of *nix *do* and some versions *don't* allow 
% access to '..' when you specify '.*' in a regular expression 
% (say, chown).

So, you did:

# chown blat .* 

Perchance

# chwon blat `pwd`/*

% I'm running RedHat on a laptop (and may need to re-install 
% now), but I'd like to avoid this in the future.
% 
% Is there a way to set something so this *won't* happen?  If I 
% want to change ownership of all of a user's files (because I 
% copied one user to another) but don't want it going ../../.. 
% on me (and thereby changing the entire filesystem).  Is there 
% a way to do that?  Probably in root's setup files?

I wonder if this isn't a (mis)feature of the shell, which does
the file name globbing before the command invoked (chown, in this
case) ever sees the list of filenames? I seem to recall a noglob
option for bash ("set -o noglob", like "set -f"), but that turns off
all pathname expansion.

% First clue: chown takes a while
% Second clue: error message:
% 	chown: changing ownership of '../proc/526' : Operation not 
% permitted

Oops. ;-)

% Thanks for any suggestions you can give me (besides never log 
% on as root).

See above.

Kurt
-- 
Meader's Law:
	Whatever happens to you, it will previously have happened to
everyone you know, only more so.


More information about the Linux-users mailing list