Path: utzoo!attcan!uunet!tut.cis.ohio-state.edu!ucbvax!MCIRPS2.MED.NYU.EDU!karron From: karron@MCIRPS2.MED.NYU.EDU Newsgroups: comp.sys.sgi Subject: Re: chown thru multiple directories Message-ID: <9007072013.AA25848@mcirps2.med.nyu.edu> Date: 7 Jul 90 22:31:51 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 36 X-Unparsable-Date: Sat, 7 Jul 90 13:13:20 DSD JORDAN%gmr.com@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? > >Or will I have to write my own shell program? Do this one liner: find /$startdir -exec chown $username "{}" \; -print Rr to change both the user and the owner find /$startdir -exec chgrp $usergrouop "{}" \; -exec chown $username "{}" \; -p rint the -print is optional. It justs shows you what find is finding. Replace $startdir,$username,$usergroup with your actual value. Tar also has setting that will unload an archives with the current users ownership and group. Have to look that up. I always forget it when unloading tar archives and then do the above to fix things. The real problem is when you are unloading an archive with root permissions as a user with no permissions. Then you can not chown and chgrp on the monster you have just created. You are stuck until root can do it for you. -- +-----------------------------------------------------------------------------+ | karron@nyu.edu Dan Karron | | . . . . . . . . . . . . . . New York University Medical Center | | 560 First Avenue \ \ Pager <1> (212) 397 9330 | | New York, New York 10016 \**\ <2> 10896 <3> | | (212) 340 5210 \**\__________________________________________ | +-----------------------------------------------------------------------------+