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

Re: chown all files on a data drive



----- Original Message ----- From: "Alex Samad" <alex@samad.com.au> Sent: Saturday, January 05, 2008 7:19 PM

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.

I've tried the chown & chmod solution (not the more eloquent above) to a small set of folders and files for a test

I'm not sure exactly what you're trying to accomplish. If you want everyone to have access to the drive you can do something like:

# chown -R root:root /share/other
# chmod -R o+rwX /share/other

I can access the files but not delete, etc. I've even tried changing the group to users and adding myself to the users group (100). Still can delete the files and it isn't apparent if I can otherwise modify files. Generally all files are now root:users -rw-rw-rw. I used to run SELinux which adds a whole bunch of other things to files, if the current Etch kernel is SELinux aware, could this be causing my problems?

Also, with Gnome Nautilus permissions, it doesn't do recursive changes, is there some way to get the recursive changes?


Reply to: