Creating and Managing Home Directories
If you don't want to use folder redirection policies but you still want to have users put their data on servers, you can use classic home directories. A home directory provides a convenient storage location that users seem to understand. You can say, "Put it in your U drive," and users generally know what you want them to do.
Preparing home directories for users is a two-step process:
Designate a home server and create a shared folder to host the user's home directories.
Configure each user's account in Active Directory to point at the shared folder on the home server.
Home directory information is stored in the User object in Active Directory in two attributes: Home-Directory and Home-Drive.
Any server can host home directories. It does not need to be a Windows server. If you have clients with multiple network providers, the home directory can be a NetWare or Banyan or UNIX box running NFS (Network File System).
If you use a Windows server, be sure to create the user home directory share on an NTFS volume so you can take advantage of file and folder permissions to keep users out of each other's personal data.
Assigning a Home Directory Using AD Users and Computers
You can create home directories in two ways. You can use the graphical user management tools in the AD Users and Computers console or you can use the command line. Let's start with the console. Assign a home directory to a user account as shown in Procedure 19.1.
Procedure 19.1 Assigning a User Home Directory with AD Users and Computers
Open the AD Users and Computers console and expand the tree to where the user objects are stored.
Double-click the user object to open the Properties window.
Select the Profile tab (see Figure 19.4).
Figure 19.4. User Properties from AD Users and Computers console showing home directory setting under Profile tab.
Under Home Folder, select the Connect radio button.
Enter the drive letter you want to use for the home drive and the UNC path to the home directory.
Click OK to save the changes and close the Properties window. The system automatically creates a home directory at the specified shared directory. The ACLs are automatically configured to give the user and the Administrators group Full Control rights.
Creating Home Directories from the Command Line
If you don't like using a GUI for something as simple as creating a home directory, here are the actions for creating user home directories from the command line. Most of the tools come as standard utilities. A few tools come from the Resource Kit. The example shown in Procedure 19.2 creates a home directory for a Help Desk administrator named Rita Manuel.
Procedure 19.2 Assigning a Home Directory Using the Command Line
Open a command prompt and enter the following command to create the user account:
net user rmanuel * /add /fullname:"Rita Manuel" /comment:"Help Desk Admin" /domain
The * forces Net to prompt for a password and confirmation rather than entering the password on the command line.
The /domain switch adds the user to the Active Directory. Without this switch, if you are at a member server or workstation instead of a domain controller, the net user /add command creates the account in the local Security Account Manager (SAM).
Create a home directory for Rita. This can be done at the console of the server or across the network as follows:
If you choose to create individual shares for home directories, create a share point at the console of the server using the Net Share command as follows:
net share rmanuel=c:\users\rmanuel
To create a share across the network, use a tool in the Resource Kit called RMTSHARE. You must be logged onto the domain with administrator privileges to use RMTSHARE. The syntax for this utility is as follows:
Set Rita's user account to point at the home directory. This is also done with the Net User command. The default home drive letter is Z. No command-line option exists for setting a different drive letter. The syntax is as follows:
net user rmanuel /homedir:\\S1\rmanuel
At this point, Rita's home directory inherits access permissions from its parent. This might include other users or inappropriate groups. Set the ACLs on the home directory so that only Rita can access it. The command-line utility for applying NTFS file permissions is Cacls.exe. You can use CACLS locally or across the network. This is the syntax for giving Rita and Administrator Full Control rights and removing everyone else from the ACL:
cacls \\S1\users\rmanuel /t /g rmanuel:f /g administrator:f
The /t option applies the change to the directory and all child directories and files.
The /g option grants the specified permissions to the user.
The rmanuel:f option grants Full Control access to Rita's account. The same is true for the Administrators local group.
When you enter this command, CACLS prompts for confirmation. Enter Y for Yes and the change is applied.
Finally, if you intend on using quotas, you need to set ownership of Rita's home directory to Rita. This cannot be done using tools from Microsoft. I recommend the CHOWN utility from Services for UNIX (SFU).
Armed with these commands, you can build a script to automate a user addition. Be sure to give the script file a .cmd extension. The following example shows a simple batch script that accepts the user's login ID, full name, and title as command-line arguments:
net share %1=c:\users\%1 (or rmtshare \\S1\%1=c:\users\%1)
net user %1 * /add /domain /homedir:\\S1\users\%1 /fullname:%2 /comment:%3
cacls \\S1\users\%1 /t /g %1:f
chown \\S1\users\rmanuel rmanuel
You can use VBScript, JScript, or Perl to make more elaborate scripts. The person using the script must have sufficient administrative rights to add user accounts and modify ACLs.
Mapping Home Directories for Downlevel Clients
When you assign a home directory to a user at a modern Windows client, the home drive is mapped automatically when the user logs on. This is not true for users at downlevel clients such as Windows 3.1x and Windows 9x. Downlevel clients require that the home directory be mapped in a logon script. Here is the syntax:
net use u: \\S1\users /home
A limitation of classic Windows clients is that a network drive can only map to a share point, not a folder underneath.
For example, if you map the U drive for a downlevel client to \\S1\users\dletterman, the client maps only to the users share, so the U drive contains all the home directories, not just the files for dletterman.
The workaround is to create a share for each user home directory. You can hide the shares from the browser by giving them a dollar-sign ($) ending. For example, if the physical directory holding home directories is on the E drive of the server with the path E:\Users\DLetterman, the share point would be Dletterman$ and the UNC path would be \\S1\dletterman$.
The dollar sign does not truly hide the share, so don't use it in place of tight NTFS security on the home directory folders.
Terminal Services and Home Directories
In the multiuser environment of terminal services, user configuration settings are saved to the user's home directory. If a user does not have a home directory, terminal services creates one in the user's local profile. This is done by a set of batch files that run each time a user logs on at a server running terminal services.
For example, Office 97 applications save user templates to C:\Program Files\Office97\Templates. If this is done in a terminal services environment, users would overwrite each other's templates. A set of scripts in the \Windows\Application Compatibility Scripts folder redirect common folders used by older applications to the individual user's home directory.