Rename user - file/dir ownership?

Erik Christiansen erik at dd.nec.com.au
Tue Nov 21 05:19:00 UTC 2006


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




More information about the ubuntu-users mailing list