Click to See Complete Forum and Search --> : Automount script


jonathen
06-20-2003, 09:26 AM
Hi all,

I have just started using red hat on my dual boot laptop, and whilst I am fairly savvy with running a linux server, I have never used redhat as a desktop.

My partitions are:

XP
Scratch
RedHat

The Scratch partition is for my personal files which I use both in XP & RH. What I want, is when I boot in RH as a normal user, my partition Scratch autmounts to my /mnt dir, chmods all files to 777 and chowns all files to my normal user.

I can do all that manually, but it's a pain! Is there a way I can do this so that I can access my scratch partition in xp or rh without having to go through the manual hassle?

Any help appreciated,

Jonathen

goldbug
06-20-2003, 10:24 AM
A nice easy hack (maybe not the "securest") would be to put an entry in /etc/fstab

something like:

/dev/hda2 /mnt/scratch vfat uid=1001,gid=1001,fmask=0777,dmask=0777 0 0


That usually does the trick.

You'll need to change the partition to be the right number for your system, and the user/group IDs accordingly. This also assumes your scratch drive is FAT/FAT32

jonathen
06-20-2003, 10:46 AM
Excellent, that should do the trick - thanks alot :)

jonathen
06-20-2003, 01:34 PM
Ah, I have a problem. That code mounts the drive nicely, and I can browse it etc, but cannot write to that folder. It must be permissions, but I don't see what...

goldbug
06-20-2003, 03:49 PM
Not sure if this is the case, or even possible:

Could it be that you are writing to a preexisting folder, in which case, the permissions might be different for that specific folder?

With the mount set 0777, *anyone* should be able to write to it (as you already know).

Check to see who actually owns that mount and the folder in it. If it's root, than I screwed up in that fstab line or something (tho, I could've sworn that you can set fmask,dmask on vfat mounts, the UID could also be wrong. (set to your numerical UID))

jonathen
06-20-2003, 04:41 PM
Doh! I forgot about the UID. That fixed it, thanks :)