chown thru multiple directories

Urs Meyer meyer at gorgo.ifi.unizh.ch
Tue Jul 10 20:52:23 AEST 1990


>JORDAN%gmr.com at relay.cs.net asks about "chown thru multiple directories"
>
>>Is there a command available that will change the owner and group
>>of every file in the current directory, and every file & directory
>>below the current directory?
>
>Do this one liner:
>
>find /$startdir -exec chown $username "{}" \; -print
>
>| karron at nyu.edu                          Dan Karron                          |

WARNING:
There is a security leak in this procedure if the super-user executes
the find command.  If a file in the user's directory tree is a
(symbolic) link, the file pointed to by the link will change ownership
and not the link itself.  Therefore, if the user has a link to /etc/passwd, 
he will own is afterwards.
This is true at least up to IRIX 3.2.1.

Omit at least the links in the find command:

	find /$startdir ! -type l -exec ...

Or let the user copy his stuff using tar. 

I really don't like the way symbolic links are implemented in IRIX.
But, there have been enough discussions on that topic.

Urs Meyer ---------- meyer at ifi.unizh.ch, {uunet,...}!mcsun!cernvax!unizh!meyer
University of Zurich, Dept of Computer Science, Multimedia Lab, CH-8057 Zurich



More information about the Comp.sys.sgi mailing list