Using shared personal folders among Vista and Ubuntu – Fixing the permissions problem

Since about a week or so I’ve been running Ubuntu and Windows Vista in dual boot. I’ve had Windows Vista for a longer time already and after trying Ubuntu from the LiveCD I decided it was time to install it for real. When doing this stuff you really need to plan how you’re going to use your available hard disk space. What I wanted to achieve was to be able to access all my personal files from both Ubuntu as well as Vista. By personal files I mean the files that are stored in Documents, Music, Videos, Pictures, etcetera. Both Vista and Ubuntu have these folders built in.

I decided to create a FAT32 partition to hold these personal folders. I knew I could then change the location of the personal folders in Vista to this FAT32 partition and create symbolic links to these folders in Ubuntu. This way it looks like you’re just browsing your Documents folder while you’re actually on the Documents folder on the FAT32 partition. This all seemed to work out great. I had my personal folders in my ‘/home’ folder on Ubuntu and in Vista I could reach them via Username -> Documents.

But ofcourse things can never be as easy as they seem. After doing this I didn’t have write access to some of my personal folders in Ubuntu. The folders that were linked to personal folder in Vista were read only, all the other folders on the FAT32 partition adhered to rules I had set in /etc/fstab. I participated in a couple of forum threads about this, but nobody ever seemed to be able to provide a solution. I still don’t really know what’s causing this problem but I have found a way to fix it. The answer is really quite simple but it’s not something you’d expect.

We’ll start off by linking Vista’s personal folders to the ones on the data partition. You can do this by right clicking on of the personal folders, going to the tab that says ‘Location’ and change the location listed there. In my case I’m pointing my Documents folder to ‘E:WalterDocumenten’ as you can see in the following image:

There are also folders that Vista doesn’t have natively while I do want them in my Personal folder. In my case for instance that’s a ‘Webs’ folder. It’s the one where all my web development projects are in. To have it show up in your personal folder you can just make a new shortcut to it. You can even pick a nice icons for it. See below:

Here’s what my data partition looks like in Vista after changing the location of my personal folders to it. The folders actually get the same icons:

If I reboot into Ubuntu now and go to my data partition (I’m assuming you already mounted your FAT32 partition correctly) I’m seeing something really odd. The folders that have been linked to from my personal folders in Vista are locked. The non Vista native folders like the ‘Webs’ folders aren’t. See the two images below:

If we type the ‘ls -al’ command in the terminal for the folder that you mounted your data partition to (in my case it’s located at ‘/data’) we can see what the locks mean:

The folders appear to be read only. This wasn’t the case before we did our thing in Vista. As a matter of fact it’s not supposed to be possible since FAT32 partitions don’t support file and folder permissions and so should be mounted according the rules you set in ‘/etc/fstab’. We’ll fix this strange behaviour later. First we’ll set up symbolic links to these folders from our ‘/home’ folder. To be able to do that we’ll first delete Ubuntu’s native personal folders that have similar names. In my case I needed to delete ‘Pictures’, ‘Documents’, ‘Videos’ and ‘Downloads’. See the two images below for a before and after shot of my ‘/home’ folder (/home/waltervos in my case).

Now we’ll set up the symbolic links. First off open up a terminal as root: press ALT + F2 and type ‘gksu gnome-terminal’. You’ll be prompted to enter your password. The syntax for symbolic links that we’ll be using is ‘ln -s [TARGET] [LINK FOLDER]‘. In my case, to make a link to my ‘Downloads’ folder I had to enter the following: ‘ln -s /data/Video /home/waltervos/’. This creates a link to ‘/data/Video’ in the ‘/home/waltervos’ folder with the same name as the target folder. See the image below for all the commands I used:

This made my ‘/home’ folder look like so:

Unfortunately the file permissions remain the same. We still can’t write to some of the folders. To fix this strange bug (feature?), all you really need to do is chmod the misbehaving folders in their original location like so (execute these in a terminal as root as we did when creating symbolic links earlier):

chmod 0775 -R /data/Documents

chmod 0775 -R /data/Pictures

chmod 0775 -R /data/Video

chmod 0775 -R /data/Music

Do this for every misbehaving folder and the problem is solved. Once again, what’s strange about this is that FAT32 partitions aren’t supposed to support file and folder permissions. The above commands aren’t supposed to work! See the image below for a before and after shot:

If we reboot into Vista now we’ll see that some things have changed. We lost the icons on the personal folders that Vista and Ubuntu have in common now, and there is a double Documents folder now. You can delete the one that’s empty.

This is what you’ll end up with. Your personal folders are now accessible under Ubuntu and Vista in their default location. Unfortunately you have lost the pretty icons in Vista because of this and I haven’t found a way to do something about that yet. It’s really not that big of a deal I think.

Please do post your thoughts on this article in the comments. Do you know why this is happening? Did this walkthrough help you out?

Leave a Reply

Your email address will not be published. Required fields are marked *