-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 01/31/2011 01:19 PM, Paul Heinlein wrote: > On Mon, 31 Jan 2011, Soo-Hyun Choi wrote: > >> Hi there, >> >> 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) > > For the sake of argument, I'm going to assume that your current /home > and the new /export/home are on separate disks or partitions. That is, > you need to make a full copy of the existing directories rather than > just renaming them. > > The following instructions should all be done as root. > > 1. rsync -av --delete /home/ /export/home/ > > 2. Edit /etc/default/useradd so that HOME=/export/home > > 3. Run /usr/sbin/genhomedircon > > 4. Verify the change in > > /etc/selinux/<<SELINUXTYPE>>/contexts/files/file_contexts.homedirs > > 5. Make sure that /export/home has the right contect: > > semanage fcontext -a -t home_root_t /export/home > > 6. Run fixfiles to see if anything is amiss: > > /sbin/fixfiles check /export/home > > If something fixfile reports errors, use it to fix things: > > /sbin/fixfiles restore /export/home > > 7. Disable user logins (including your own). > > 8. Update /etc/password with new $HOME definitions > > 9. Re-run rsync, if necessary, to catch last-minute changes: > > rsync -av --delete /home/ /export/home/ > > 10. Make the older /home/* directories unreadable. > > 11. Enable user logins > > 12. Tell your users emphatically that they should use $HOME anywhere > they're tempted to hardwire their home directory path into a > script. :-) > If you are using RHEL6 or its equivalent: # semanage fcontext -a -t home_root_t /export # semanage fcontext -a -e /home /export/home # restorecon -R -v /export/home # mkdir /export/home # mv /home/* /export/home/* # restorecon -R -v /export -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/ iEYEARECAAYFAk1IcTIACgkQrlYvE4MpobOk3QCeM+v1k1h7UHUQh+xCe/WSk5/y qgAAoLmg1eeH1WAdOPlnNgeEILRWhrIO =c39d -----END PGP SIGNATURE-----