Previous Table of Contents Next


Creating a Home Directory

The home directory is that portion of a file system that is allocated to an individual user for storing private files. The amount of space you allocate for a home directory may vary, depending on the kinds of files the users create and the type of work they do. You should probably allocate at least 15 Mbyte of disk space for each user's home directory.

A user's home directory can be either on the local system or on a remote file server. In either case, by convention the home directory is created as /export / home /login-name. Note that this convention is new with Solaris 2.x. The server name is no longer included as part of the user's home directory path. On a large server that supports a number of users' home directories, there may be a number of directories under /export--such as home1, home2, home3, and so on--with directories for different users under them. Regardless of where their home directory is located, users access their home directory through a mount point named / home/login-name.

Always refer to the home directory as $HOME, not as /export/home/username. In addition, use relative paths to create any symbolic links in a user's home directory (for example, ../../../x/y/x), so that the links are valid no matter where the home directory is mounted.

This section describes the default procedure for Solaris 2.x, which assumes that the user's system is on a network and that AutoFS is used to make the home directory accessible. Whether the home directory originates on a server or on the local system, you need to make it accessible to other systems by using the share command to export the file system so that the user can access the home directory from other systems on the network.

In addition, you need to define how the home directory is mounted, by either:

  Adding an entry to the NIS+ Auto_home database, NIS auto.home map, or local /etc/auto_home files so that the home directory is automatically mounted. This is the preferred method.
  Adding an entry in the /etc/vfstab file on the user's system to NFS-mount the home directory.

To support automatic mounting of home directories, the SunOS 5.x system software includes this entry in the /etc/auto_master file:

/home      /etc/auto_home

This entry tells AutoFS to mount the directories specified in the auto_home database onto the /home mount point on the local system. The entries in auto_home use this format:

login-name    system-name:/export/home/login-name

When a user logs in with login-name, AutoFS mounts the specified directory (/export/home/login-name) from f the specified system (system-name) onto the /home mount point on the system to which the user is logged in.

This method works even when the home directory is stored on the same system to which the user has logged in. But more importantly, the user can log in to any other system and have his or her home directory mounted on /home on that system.


NOTE:  When AutoFS is used to mount home directories, you are not permitted to create any directories under the /home mount point on the user's system. The system recognizes the special status of /home when AutoFS is active.

To create a home directory, you must already have created the user's account. You need this information:

  User's login name and UID.
  The name of the system on which to create the home directory. If the home directory is accessed over the network, the home directory system should be on the same network segment as the user's local system. Use the df command to check the servers to make sure there is enough space for a new home directory.
  The name of the directory where you will create the user's account. By convention, the home directory is named /export/home. However, on a large file server you may have multiple directories--/export/home1, /export/home2, and so on. Under each directory, different subdirectories are created for different users (for example, /export/home/login-namea, /export/home/login-nameb ... /export/home1/login-namey ... /export/home2/login-namez, and so forth).

All these steps apply regardless of whether the home directory is created on the local system or on a remote file server:

1.  Become superuser on the system where you want to create the home directory.
2.  Type cd /export/home-dir and press Return. The home-dir is the name of the directory where you want to create the user's home directory. For example, to change to the directory /export/home1, type:
# cd /export/home1
3.  Type mkdir login-name and press Return. login-name is the login name of the user. You have created a directory that matches the login name of the user. For example, to create a directory for a user withf a login name of ignatz, type:
# mkdir ignatz
4.  Type chown login-name login-name and press Return. The user now owns the home directory. For example, for user ignatz, type:
# chown ignatz ignatz
5.  Type chgrp primary-GID login-name and press Return. The user is assigned to the primary group you specified in the Passwd database for the user account, for example, the staff group:
# chgrp staff ignatz
6.  Type chmod 755 /export/home-dir/login-name and press Return. The user's home directory permissions are set to rwx for owner, r-x for group, and r-x for other:
# chmod 755 /export/home1/ignatz
#


Previous Table of Contents Next