Rename user - file/dir ownership?

ben darby ben at
Tue Nov 21 05:26:37 UTC 2006

* 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?

edit your /etc/passwd,shadow + group files change only the username (first
field in the first two files and then all occurances of it in the group file)
to your new username, and all the permissions, etc will automatically be
updated to the new name as they are bound to UID/GID not a specific name. you
also just rename the home dir to the new username but that isnt necessary (if
you do u'll have to change the last field in the passwd file.

ben darby
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <>

More information about the ubuntu-users mailing list