Mounting drives after login

I’m trying to set up my Virtual Machine at work to play nicely.

I’m trying to mount a shared folder on the host (Windows XP) to the VM (Ubuntu 10.04) on boot. Now I’ve mounted it fine normally using the command

sudo mount -t vboxsf Share /home/chris/folder/

and I’ve been told that putting in

Share   /home/chris/folder/        vboxsf  defaults  0       0

into /etc/fstab works.

However my home partition is encrypted and so when I restarted the machine, Linux moaned on reboot that it couldn’t mount it.

I then tried to mount it via a script that would startup on boot (via the startup applications menu) as it was my belief that this runs on user login and thus will run AFTER the home directory is unencrypted.

However I cant get it to work. I did add myself to the sudoers file with the line

chris ALL = NOPASSWD: /home/chris/Script/Startup.sh

and running the script seemed to work until I rebooted.

The script is

#!/bin/sh
sudo mount /home/chris/folder/
SpiderOak

with the line still in /etc/fstab/

Anyone got any ideas how I can sort this out? The folder needs to be mounted where I’ve specified so I cant change that.

Depending on your shell, you can add that to the .profile or .bash_profile in your home directory on ubuntu.

Just add the script to the end of the profile file?
ie


# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.

# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
	. "$HOME/.bashrc"
    fi
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

/home/chris/Scripts/Startup.sh

?