Unix / Linux change a user's home directory - usermod

chris (2006-09-12 01:21:02)
47624 views
6 replies
I watched somebody change a user's home directory today by deleting the user using 'userdel' and then re-creating the user with 'adduser' and entering a different path for their home directory. This is not the simplest way to do it..

To change the user's home directory, just use the 'usermod' command, which exists on all unices. It works like this:

usermod -d /path/to/new/homedir/ username

easy

christo
comment
Eduardo M
2008-08-08 18:57:39

You saved me.

I watched somebody change a user's home directory today by deleting the user using 'userdel' and then re-creating the user with 'adduser' and entering a different path for their home directory. This is not the simplest way to do it..

To change the user's home directory, just use the 'usermod' command, which exists on all unices. It works like this:

usermod -d /path/to/new/homedir/ username

easy

christo


Man, you saved me. I was freaking out trying to change users home directory. Perfect tip.
reply iconedit reply
Anonymous
2008-10-20 14:07:36

Thanks

Thanks man, appreciate it.


I watched somebody change a user's home directory today by deleting the user using 'userdel' and then re-creating the user with 'adduser' and entering a different path for their home directory. This is not the simplest way to do it..

To change the user's home directory, just use the 'usermod' command, which exists on all unices. It works like this:

usermod -d /path/to/new/homedir/ username

easy

christo
reply iconedit reply
Ion Lupascu
2009-08-21 08:02:49

I watched somebody change a user's home directory today by deleting the user using 'userdel' and then re-creating the user with 'adduser' and entering a different path for their home directory. This is not the simplest way to do it..

To change the user's home directory, just use the 'usermod' command, which exists on all unices. It works like this:

usermod -d /path/to/new/homedir/ username

easy

christo

Very nice command.
Thank you!
reply iconedit reply
anonymous
2009-12-14 09:57:54

Thanks

Thank you.
reply iconedit reply
Marco from Rome
2010-03-07 07:42:40

You saved my day :)
reply iconedit reply
sam
2010-04-16 10:21:06

If you don't have root acces,
you can just add this line in your .bashrc:

export HOME=/path/to/home
reply iconedit reply