LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Changing Home Dir Path (https://www.linuxquestions.org/questions/linux-software-2/changing-home-dir-path-524868/)

paul.hendrikus 02-01-2007 11:46 PM

Changing Home Dir Path
 
Is There anyway to change my default home dir path /home to another path.. like /local/home ?

Thank you for your help ...

gilead 02-02-2007 12:25 AM

usermod can do this - have a look at man usermod for more info.
Code:

usermod -d /local/home/steve -m steve

paul.hendrikus 02-02-2007 03:09 AM

Thank's Steve :)

How about if i want to change the /home directory for all user by default.

Many Thank's

Paul

jschiwal 02-02-2007 03:26 AM

I'll make a wild guess and say that you have a /home directory on your root (/) partition and found it is filling up.
If you have another partition, you can mount it as home.

Otherwise, I think that what usermod -d does is to modify your home directory field in /etc/passwd. You may still need to move your home directory contents there. (However, I'm not sure, and I'm not going to test it on my system.) You might try moving your entire home directory (as root) and use the usermod command.

If every user has a directory in /home, you could do something like this:
Code:

for user in /home/*; do
  mv $user /local/
  usermod -d /local/$user
done


fukawi2 02-02-2007 08:12 PM

To change the default path for new users, edit your adduser.conf file (/etc/adduser.conf on my system)

Have a look at the DHOME variable:
Code:

# The DHOME variable specifies the directory containing users' home
# directories.
DHOME=/home


gilead 02-02-2007 08:38 PM

The HOWTO file that comes with shadow-4.0.3 gives the file /etc/default/useradd for these settings. Editing that file on a Slackware 11.0 system and then running useradd -D shows it using the settings. So for systems like Slackware that use the standard shadow package, /etc/default/useradd is the file to modify so that new (not existing) users get the updated settings.

fukawi2 02-02-2007 09:18 PM

Correct - I wasn't sure what Distro you're using.

RedHat / Fedora / CentOS / Ubuntu (and variants) seem to be /etc/adduser.conf
Slackware and variants are apparently /etc/default/useradd

fotoguy 02-05-2007 02:47 AM

Or if you add a user by the command line you can do something like this

Code:

/usr/sbin/useradd -d /local/home/bill -s /bin/bash -m -k /etc/skel -c bill -g bill bill


All times are GMT -5. The time now is 03:38 PM.