Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Apr 1999 08:18:24 -0400
From:      "Brian J. McGovern" <mcgovern@spoon.beta.com>
To:        lore@phile.com.au
Cc:        questions@freebsd.org
Subject:   RE: Chaning a user's uid
Message-ID:  <199904291218.IAA44282@spoon.beta.com>

next in thread | raw e-mail | index | archive | help
Now you know the joy of trying to change a user's UID, and why so many people
discourage doing it.

Anyhow, to change a users home directory, completely, the easiest method is
to just:

cd ~user
chown -R user.group .

That will change ownership on everything from the current directory down.

If you don't want to modify . (most installations do let the user own their
own directory), then something along the lines of

cd ~user
chown -R user.group * .[a-z]* .[A-Z]*

should do what you want.


However, also keep in mind that there may be files elsewhere in the system
(like their mail spool) that needs to be changed as well. In this case, I
suggest that you look at:

chown user.group `find / -uname <olduid>`

But, thats a pretty powerful command that will blindly go through the file
tree and change ownerships on EVERYTHING owned by the original user. There
are two immediately visable caveats. First, you might not want to do that.
There may be files that used to be owned by this user that you don't want
to change ownerships on (I'm at a loss for what, but there may be cases).
Secondly, if there are too many files, the command will die with 'Too many
arguments', and you'll have to look at xargs, or something, which is beyond
the scope of me writing an email 10 minutes after I get out of bed.
	-Brian



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199904291218.IAA44282>