Home directory

From Wikipedia, the free encyclopedia

In computing, a home directory is a directory which contains the personal files of a particular user of the system.

Separating user data from system-wide data avoids redundancy and makes backups of important files relatively simple. Furthermore, Trojan horses, viruses and worms running under the user's name and with their privileges will in most cases only be able to alter the files in the user's home directory, and perhaps some files belonging to workgroups the user is a part of, but not actual system files.

[edit] Implementations

On Unix and Unix-like systems, a user's home directory contains all that user's documents and other personal data, including his configuration files of preferred settings for any software he has used there and might have tailored to his liking: web browser bookmarks, favorite desktop wallpaper and themes, passwords to any external services accessed via a given software, and so on. The user can also keep additional software which may not have been installed on the system as a whole. This directory will usually be organized with the use of sub-folders, at the user's preference.

The content of one's user home directory is private and can be made unavailable to other users of the system (local or remote), protected by a mechanism of file system permissions. Note however that anyone who has been granted superuser privilege, such as the system administrator, has authority to access any protected location on the filesystem.

The home directory is defined as part of the user's account data (for instance on Unix in the /etc/passwd file). It is where a user's focus is located upon login in a shell (as visible at the Command line interface prompt or via the "pwd" command).

The name of the home directory depends on the operating system, but there appears to be some convergence in recent years. In all cases "name" is the users name or id.

On Windows the directories are always on the system drive, typically C:, so many of the above names can be prefixed with C: to make them not depend on the current drive. Conversely, not specifying the drive will allow the system drive to be different (perhaps D:). In addition, before Windows Vista, the name of the directory was localized into the language of the installed system. Thus the most reliable way to find the home directory was to expand the shell expansion %UserProfile% (and use relative naming from there to find other users).

On Unix-derived systems the home directory of the superuser does not follow the naming conventions of other users. Traditionally it was /, but on many newer systems it is located at /root (Linux, BSD), or /var/root (Mac OS X). The easiest way to find a home directory is to expand the Environment variable $HOME and use relative naming from there, but the official method is to parse the data out of the file /etc/passwd.

Single-user operating systems (which may be used by more than one person, but which are called "single-user" because they do not differentiate between different owners' files) typically do not have home directories, though they may have separate disks or partitions which may or may not be used for this purpose. For example, AmigaOS versions 2 and up have "System" and "Work" partitions on hard disks by default. The BeOS (and its successors) have a /home directory which contain the files belonging to the single user of the system. Early versions of Windows did not have the user name, and thus /MyDocuments was in effect the single users home directory. In NeXTSTEP and OPENSTEP in a single user, non-networked setup, /me is used, as well as /root when logged in as superuser.

An additional Unix naming convention (originating from the csh shell) is that ~user can be used as shorthand for referring to the home directory belonging to user, whatever its location on the filesystem. This is why many web servers are configured to show a user's personal website when a URL such as http://www.catb.org/~esr/ is accessed (in this example, the username is esr). A further shorthand allows a user to refer to his own home directory simply as ~ (the tilde character).

In the VMS operating system, a user's home directory is called the "root directory", and the equivalent of a Unix/DOS/Windows/AmigaOS "root directory" is referred to as the "Master File Directory".

[edit] See also