Re: chown all files on a data drive
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
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.
Reply to: