[olug] Chgrp / chown question

Brian Roberson roberson at olug.org
Thu Sep 11 20:05:09 UTC 2003


find /dir -user $USER -exec chown $NEW_USER {} \;
find /dir -group $GROUP -exec chgrp $NEW_GROUP {} \;

----- Original Message ----- 
From: "Tim - DZ" <iceburn at dangerzone.com>
To: "'Omaha Linux User Group'" <olug at olug.org>
Sent: Thursday, September 11, 2003 2:52 PM
Subject: RE: [olug] Chgrp / chown question


> I knew I wasn't stating my question quite clearly...
> 
> I don't want to do all the files, just the specific ones...
> So:
> 
> [root at server]# ls -al 
> total 32
> drwxr-x--x    6 root     grpA         4096 Aug  8 08:50 .
> drwxr-xr-x    8 owner1   grpA         4096 Sep 11 14:05 ..
> drwxr-xr-x    9 owner1   grpB         4096 Feb 17  2003 These
> -rwxrwxr-x    1 root     grpC         2886 Feb 17  2003 DirNFile
> -rwxrwxr-x    1 owner2   grpA         3126 Feb 17  2003 Names
> drwxr-xr-x    3 owner1   grpC         4096 Feb 17  2003 Dont
> drwxrwx--x    6 owner2   grpB         4096 Feb 17  2003 really
> drwxr-xr-x    7 owner3   grpA         4096 Aug  8 09:14 matter
> 
> I want all the files/dirs owned by owner1 to now be owned by a user
> called "joe" (even on files/dirs lower that current)
> and leave files/dirs owned by owners2,3 and root alone.
> 
> chmod -R -from=owner1 joe
> 
> Ok, so that's good to go
> 
> Now I want all files/dirs in the grpB to now be in grpQ (even on
> files/dirs lower than current)
> And leave files/dirs owned by groups A and C alone.
> 
> ????   
> 
> -t
> 
> 
> 
> 
> 
> -----Original Message-----
> From: olug-bounces at olug.org [mailto:olug-bounces at olug.org] On Behalf Of
> Kenton Brede
> Sent: Thursday, September 11, 2003 2:31 PM
> To: Omaha Linux User Group
> Subject: Re: [olug] Chgrp / chown question
> 
> 
> On Thu, Sep 11, 2003 at 02:13:31PM -0500, Tim - DZ wrote:
> > So I have a set of directories.  Under the root of this set there are 
> > various permissions set and various directories owned by particular 
> > users and groups.
> > 
> > The goal is to basically be able to change a specific owner to a 
> > different owner recursively on all files.  And then independantly do 
> > the same for the group.
> > 
> > Now chown has a -from option, so I can recursively (-R option) find 
> > all files owner by user A and change the owner on just those files to 
> > user B.
> > 
> > But how can I do the same for groups?
> 
> You can use "chgrp -R"  Or do them both at once with chown -
> $ chown -R user.group *
>                ^
> Some variants of chown use ":" as a delimiter and not "." as I used
> above. Kent
> 
> -- 
> "I am always doing that which I can not do, 
>    in order that I may learn how to do it." --Pablo Picasso
> 
> _______________________________________________
> OLUG mailing list
> OLUG at olug.org
> http://lists.olug.org/mailman/listinfo/olug
> 
> _______________________________________________
> OLUG mailing list
> OLUG at olug.org
> http://lists.olug.org/mailman/listinfo/olug
> 


More information about the OLUG mailing list