Rename user - file/dir ownership?
Johan Ramm-Ericson
ubuntu at ramm-ericson.se
Tue Nov 21 07:05:10 UTC 2006
On Tue, November 21, 2006 06:15, Erik Christiansen wrote:
> On Mon, Nov 20, 2006 at 10:58:41PM -0500, Dave M wrote:
>> I need to rename a user (or delete an old user and replace it with a new
>> one) but I want to keep the old users /home/username directory tree
>> intact
>> and re-assign it to the new user. What is the best way to do this so
>> that
>> all of ownership/permissions are transferred to the new user?
>
> usermod -l newname oldname # For just what you ask, or
>
> mv /home/oldname /home/newname # if home dir rename is
> useful.
> usermod -d /home/newname -l newname oldname
>
> should just about do it. Now, ls -lR /home/newname should show
> everything belongs to newname. (If I haven't forgotten something. :-)
>
> Erik
Yes, but... if you are using this in a desktop login environment there
will be all kinds of references to the old user name in the Gnome (I'm
guessing in KDE as well though it's ages since I ran KDE actively)
configuration files (see the files in ~/.gconf , ~/.gconfd, ~/.gnome ,
~/.gnome2, ~/.gnome2_private , etc). Also, Mozilla & Firefox will contain
references to the old user name in the ~/.mozilla structure. I'm sure
other applications will behave in similar ways. Many of these references
will be paths to filenames so one way to work around that is by:
ln -s /home/newname /home/oldname
after the steps Erik mentioned have been executed. That probably will not
solve all problems but should get you around the most irritating ones.
Sorry, I can't be more precise than that but this should lead you in the
right direction...
Good luck,
Johan
More information about the ubuntu-users
mailing list