Home directory access on Linux and Windows

by Jay Sekora on November 5, 2009

Last updated January 28, 2010

At CCIS, you have one home directory which is used across all Systems-supported Linux and Windows (and Solaris) machines. So you’ll have the same files available whether you’re sitting at a Windows or a Linux machine. This document explains some of the implications of that fact, and how you can change it if you like.

What you will see from a CCIS Windows machine

When you first log into a college managed Windows machine you will find exactly what you expect to find when using Windows with a few changes. The folder “My Documents” will point to the same home directory as the Linux machines. And you will also find that the Z: drive is also mapped to your home directory as well.

When you open the My Documents folder you will see quite a few files beginning with a period. These dot-files are used by Linux/Unix programs to store state and settings. Unless you are sure about what they contain and what they do you should not delete any of these dot-files.

(Your scratch directory is also available on the Windows machines; it’s mapped to the Y: drive. This corresponds to /scratch/yourusername on the Linux machines. As explained in our Quota HOWTO, that space is not backed up to tape.)

What you will see from a CCIS Linux machine

Once you have logged into a CCIS Windows machine you will find a few changes the next time you login to a Linux machine. Three directories will be created by Windows. The important directory is .WIN_PROFILE; this is where Windows stores your settings for both the OS and for various applications. The other two directories are called My Music and My Pictures. Both of these can be deleted as they aren’t necessary.

One important note about the .WIN_PROFILE directory when the directory is initially created the Linux permissions will look like this:

drwxrwxrwx   12   colinj   ccsstaff   4096 Oct 14 14:59 .WIN_PROFILE

While it does look like the directory is world readable and world writable this is not really the case. (See below about Permissions.) If you feel better having the permissions look differently you can change them with the command

$ chmod -R 700 .WIN_PROFILE

Which will result in the following:

drwx------  12 colinj    ccsstaff    4096 Oct 14 14:59 .WIN_PROFILE

You may also see one file that is created by Windows. Windows uses the file desktop.ini to store information about changes that you make to your desktop.

Windows profile size

Windows applications tend to write large amounts of data into your home directory, especially into your Windows profile. In our environment, your profile is stored in a directory called .WIN_PROFILE in your home directory. (That’s your Windows home directory, but by default that’s shared with your Linux home directory — see below.)

So if you’re inexplicably running out of space, one thing to check is the size of your Windows profile. You can check that from a Linux computer by running the command

$ du -h -s .WIN_PROFILE

(-h means to print the size in human-readable units like megabytes or kilobytes, and -s means you just care about the total size, the sum, of the entire .WIN_PROFILE directory.)

If you only very rarely use a Windows machine and you don’t care about any of your Windows preferences or settings, you can delete your entire Windows profile from a Linux machine to reclaim your space.

Permissions

The Unix permissions model is based on every file belonging to a particular user and a particular group. Permissions can be set separately for that user (the owner of the file), that group (everybody who is a member of the group the file belongs to), and everyone else. For instance, if you’re a CCIS major, your files will (normally) be owned by you, and they will belong to the group majors, which includes all the other people with majors’ accounts. By default, new files you create are readable and writable by you, but just readable (not writable) by members of your group (majors) and by everyone else. Traditionally, there’s no provision for granting another person special access other than by putting them in a group the file belongs to. (We — the Systems staff — can create new groups and put people in them.)

The Windows permissions model is very different (and more sophisticated). Each file can have an Access Control List (ACL), which lists the users and groups that have privileges on that file, and what things they can do with it. So on Windows, if you want a particular person to have special access to a file you own, you can add them to the ACL without the intervention of the system administrators.

(Actually, newer Unix variants support ACLs too, but the particular fileserver technology we’re currently using doesn’t support ACLs for Unix and Linux clients.)

Our fileserver supports both ways of controlling permissions, but only one will be active at a time. The rule is that the last OS to set permissions on a file wins. So if you change permissions on a file with the chmod command on a Linux machine, then the Linux permissions are enforced for future file access (whether from Linux or Windows). On the other hand, if you change the ACL on a file or directory from Windows, then the Windows ACL is enforced on future attempts to access that file (again, whether from Linux or Windows).

This means that sometimes particular kinds of file access will be prohibited — or allowed — in one environment or the other, even though the permissions (on Linux) or ACLs (on Windows) look like they ought to allow that access. That’s because the other OS’s permission scheme is the one in effect.

This is not likely to be a problem for files which are only accessed from one OS or the other, but for files that you regularly use from both operating systems, especially if you’re trying to collaborate with other people, it may be a problem and you may find yourself needing to reset permissions frequently.

Separating your Windows and Linux home directories

If you don’t want your Windows files and your Linux/Unix files mixed in together, you can separate them as follows.

What follows must be done from a Linux computer.

If you would like to keep your Windows data and Linux data separate you can do that as well. To do this simply create a directory called .WIN_HOME (it must began with a period and be named exactly “.WIN_HOME”) and that will, the next time you logon to a Windows computer, be the root level of your home directory for Windows. The command to do this:

$ mkdir .WIN_HOME

If you have any customization to your Windows profile you can copy the .WIN_PROFILE directory into the .WIN_HOME directory and your changes will be maintained. To do this the command is:

$ mv .WIN_PROFILE .WIN_HOME

Once you do this you will not be able to access the rest of your Linux/Unix data from a Windows computer. You will be able to access your Windows data from a Linux computer since .WIN_HOME is simply a sub-directory of your Linux home directory. If at some later point you want to undo this you can just delete the .WIN_HOME file (after you have moved any data that you want to save from it).