Home directories

nadyawilliams edited this page Jun 11, 2014 · 4 revisions

Default home directory creation process

Normal home directories in rocks work like this:

  • /usr/sbin/useradd creates the home directory in /export/home/$USER (based on the settings in /etc/default/useradd)
  • rocks sync users adjusts all home directories that are listed as /export/home as follows:
  1. edit /etc/password, replacing /export/home/ with /home/
  2. add a line to /etc/auto.home pointing to the existing directory in /export/home
  3. 411 is updated, to propagate the changes in /etc/passwd and /etc/auto.home

In the default Rocks configuration, /home/ is an automount directory. By default, directories in an automount directory are not present until an attempt is made to access them, at which point they are (usually NFS) mounted. This means you CANNOT create a directory in /home/ manually! The contents of /home/ are under autofs control. To "see" the directory, it is not enough to do a ls /home as that only accesses the /home directory itself, not its contents. To see the contents, you must ls /home/username.

Changing the default

Placing user home directories on an external NAS (Rocks 5.4 or greater)

If you want to place all your home directory on an external NAS you can do the following:

mount the NFS share onto `/export/home` on your FE  
leave `/export/home` as the default dir in `/etc/default/useradd`
# rocks set attr Info_HomeDirSrv "my-server-name" (where my-server-name is the NAS internal hostname)
# rocks set attr Info_HomeDirLoc "/home-path-on-nfs-server"  

Info_HomeDirSrv and Info_HomeDirLoc will be used to compose the user line in /etc/auto.home every time a new user is added and the rocks sync users command is run. Since Rocks 6.0 you can use the Info_HomeDirOptions to set the mount options.

Relocate user home directories

Here's an overview of what to do to move a user's home directory:

  • Relocate the user's actual directory (using tar, cpio, rsync, mv, or whatever) to the new location if it isn't already there.
  • edit /etc/auto.home to point to that new location
  • update 411: (cd /var/411; make)

If for some reason it is desirable to have home directories on multiple servers, all that is necessary is to make sure all the nodes in the cluster can mount the directories from the servers (i.e., they are exported correctly), and then edit /etc/auto.home to reflect the real location of each home directory.

Removing Users

the command rocks sync users will update /etc/auto.home for existing users. When you delete a user, you will need to explicitly remove the user's home area map from auto.home.
One procedure for doing this is:

# USERNAME=<name of user to delete>
# userdel $USERNAME  
# sed -i "/^$USERNAME /d" /etc/auto.home  
# rocks sync users

You may have to explicitly unmount the user's home directory before performing the above procedure. If you are unfamiliar with userdel please see its man page

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.