[X-Unix] Changing owner globally
Stroller
MacMonster at myrealbox.com
Thu Jul 1 17:13:36 PDT 2004
On Jul 1, 2004, at 4:21 pm, Stephen Jonke wrote:
> I know this is possible, but I don't know how to format the command
> and want to make sure I have it right. My sisters Mac running 10.3.4
> was originally set up with a particular use (her Ex) as the admin and
> so lots of files are owned by his username. I want to remove his
> account and change all files on the system owned by him to be owned by
> her. What is the find (or other) command I should use to do this in
> one fell swoop?
I think something like this should do the trick:
$ sudo find ./ -user bastard_bloke -exec chown steves_sister \{} \;
You'll need to ensure she is an admin before you perform this.
> I presume I should first change ownership and then delete the account
> (what happens if you delete the account of a user that has ownership
> of files that remain on the system?)
The files are still owned by his numerical UID.
Compare:
~ $ ls -l /Users/
total 0
drwxrwxrwt 8 root wheel 272 16 May 20:18 Shared
drwxr-xr-x 13 stroller stroller 442 4 Nov 2003 stroller
and:
~ $ ls -ln /Users/
total 0
drwxrwxrwt 8 0 0 272 16 May 20:18 Shared
drwxr-xr-x 13 501 501 442 4 Nov 2003 stroller
Were I to remove Stroller from the system, this would prolly look like:
~ $ ls -l /Users/
total 0
drwxrwxrwt 8 root wheel 272 16 May 20:18 Shared
drwxr-xr-x 13 501 501 442 4 Nov 2003 stroller
If I had other users on the system the illustration would be more
explicit, but I'm sure you can work it out.
Stroller.
More information about the X-Unix
mailing list