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

Re: chown all files on a data drive



On Sun, Jan 06, 2008 at 09:18:16AM +1100, Cameron Hutchison wrote:
> dave N <drn_temp2@rogers.com> wrote:
> 
> >I used to run Fedora and now all the files on my data drives are uid
> >500 and gid 500.
> >
> >Now under Debian the same user name and password I'd previously had
> >are uid 1000 and gid 1000. Though I can access the files on the drive
> >I can't do anything with them except as root.
> >
> >How can I rectify this? chown -R 1000:1000?
> >
> >This'll cause problems with the lost+found as well as any .Trash
> >folders, should I then change the uids and gids back?
> 
> chown -R will work, but may be a little too indiscriminate.
> 
> You can be more discriminating by find(1) and only changing the UID of
> files that are 500, and a GID of 500.
> 
> $ find /path -uid 500 -print0 | xargs -0 chown 1000
> $ find /path -gid 500 -print0 | xargs -0 chgrp 1000

why not 

$ find /path -uid 500 -exec chmod 1000 "{}" \; 


I guess you will get 1 process for each file as it spawns it off ?

> 
> You can combine all this into one command if all files with UID 500 also
> have a GID of 500, but if not, the above is safer leaving you to remap
> other IDs as you need to.
> 
> 
> -- 
> To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org 
> with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
> 
> 

Attachment: signature.asc
Description: Digital signature


Reply to: