[CentOS] How to relocate $HOME directory

Mon Jan 31 06:22:48 UTC 2011
Tom H <tomh0665 at gmail.com>

On Mon, Jan 31, 2011 at 12:18 AM, Rudi Ahlers <Rudi at softdux.com> wrote:
> On Sun, Jan 30, 2011 at 11:07 PM, Soo-Hyun Choi <s.choi at terabit.org.uk> wrote:
>> As you know, $HOME is generally located at "/home/$username" by default.
>> I would like to re-locate all users' $HOME directories to something like
>> "/export/home/$username" without having a hassle/trouble.
>> Initially, I've thought of just copying them to the new directory (under
>> /export/home/xxx), but guessed it might trouble for the normal use (I'm
>> pretty new to CentOS, although many experiences with Debian/Ubuntu).
>> Is there any good tricks (or caveats) when moving users' home directory
>> cleanly with CentOS? (I'm with CentOS 5.5 x86_64)
> The easiest way would be to move (or copy) everything in /home to
> /export/home, and then remount /home on /export/home in your fstab.
> Before you remount it, you may want to rename it to say /oldhome or
> /home2 or something like that, and then if everything works fine then
> you simply delete it :)

If you're changing the root of /home to another mount point or
directory, say "/export/home", you'll also have to use semanage to set
its selinux context to "home_root_t", etc.