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

chris (2006-09-12 01:21:02)
233655 views
11 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

follow me on twitter: http://www.twitter.com/planet_guru
Digg it! Submit to Slashdot Add to Blinklist Del.icio.us Add to Newsvine Add to Technorati Add it to Google Bookmarks
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 icon
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 icon
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 icon
anonymous
2009-12-14 09:57:54

Thanks

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

You saved my day :)
reply icon
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 icon
Jared Savage
2010-09-06 09:16:49

Thanks!

Just what I needed! Thanks for the tip.
reply icon
GoodBoy
2011-07-29 17:01:20

Thank you so much!!!
reply icon
Text to Screen
2011-07-31 06:19:28

text to screen

Remember, if your Linux Server says "Command not found" then you will need to first type "ssh -" within your ssh terminal. This will allow you to access the usermod command.

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

follow me on twitter: http://www.twitter.com/planet_guru
reply icon
Wildly Inaccurate
2011-08-04 12:34:25

Thank you!

Thanks for the tip!
reply icon
Richard
2011-12-20 00:03:24

Thanks

Thanks for this great tip!
Saved a ton of time!
reply icon