Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Does anyone know how I might change my home directory in the shell please?

share|improve this question

3 Answers 3

up vote 49 down vote accepted

Running

sudo usermod -d /path/to/new/home -m *username*

will copy all files from your current home directory to /path/to/new/home and will also update the system file that stores the location of your home directory (/etc/passwd).

share|improve this answer
1  
Worked for me in Ubuntu 12.04, thanks –  HappyDeveloper Jul 4 '12 at 3:19
    
After I have done this, only desktop background is shown when I log in. For 13.10 .. even this is an answer from 2009 :) –  Aleks May 26 at 22:31
1  
@Aleks the functionality of usermod hasn't changed in years, or probably decades, so this answer should still be valid. As for why you're only seeing your desktop background, perhaps something else in your desktop environment depends on the username, in which case usermod doesn't know about it. But I can only guess at why this is happening (without having access to the system). –  David Z May 27 at 0:29
    
Thanks David. I thought too that this functionality hasn't changed in years so I have tried it. My was a fresh new install of Ubuntu, so , with additional steps, this answer helped me askubuntu.com/a/250877/223469 (just like yours, but with additional step - or more precise to create a new fresh new folder, which in my case was enough for me) thanks David –  Aleks May 27 at 7:22

http://ubuntuforums.org/showthread.php?t=46866

this is a nice How-To on home-dir moving. I Have not tried this myself, but it looks rather complicated.

Nick

share|improve this answer
    
It's not as complicated as it looks, they just had to explain in detail for people who aren't familiar with the process. All it really involves is (1) create partition, if necessary (2) mount partition (3) copy files (3) unmount partition (4) edit /etc/fstab (5) move old home directory out of the way (6) move new home directory to /home (7) mount new /home (8) check everything, and remove old home directory –  David Z Sep 13 '09 at 12:33

I have not tried this, but I think you can change it in /etc/passwd.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.