change my /home/oldname to /home/newname

Nils Kassube kassube at gmx.net
Thu May 20 15:37:22 UTC 2010


Mihamina Rakotomandimby wrote:
> > Lucian Goron <luciangoron at gmail.com> :
> >I read some threads on this topic but none of them worked
> >and the last one almost broke my system, thanks for backups
> >
> >How can I change / rename my username ?
> >but without breaking anything.
> 
> - Create the new user (the way you want)
> - copy (with cp and the right options). I would use:
>   $ sudo mv /home/new-user /home/new-user-home
>   $ sudo cp -ar /home/current-user /home/new-user

You forgot to make the new user the owner of the new home:

sudo chown -R new-user:new-user /home/new-user

> - log out
> - log in as the new user

And then you will probably find out that many applications use the old 
home when they use an absolute path e.g. in their config files. You can 
list those files referencing the old home with a command like

grep -lr /home/current-user /home/new-user

but I'm not sure if it would be safe to globally replace the old path 
with the new one.


Nils




More information about the ubuntu-users mailing list