script to access partitions only accessable as root

Mikkel L. Ellertson mikkel at infinity-ltd.com
Sun Apr 15 17:48:37 UTC 2007


Nigel Henry wrote:
> I'm still using FC2 on a daily basis, but also have FC1, 3, 5, and 6 on this 
> machine. I fetch the email on FC2, and if someone has a question regarding 
> FC6 for example, it's nice to be able to post a bit of text from a config 
> file that's on FC6.
> 
> I can create directories in /mnt with no problems, and add entries for the 
> partitions to /etc/fstab, but when I click on the desktop launcher for these 
> partitions I'm told that only root can mount them.
> 
> I can mount them individually using.
> # mount -t ext3 /dev/hdxx /mnt/hdxx
> 
> What I am looking for is a script that I can run as root, which will mount all 
> the /, and /home partitions which I have already created directories for 
> in /mnt on FC2 for FC1,3,5, and 6.
> 
> Much appreciation for any comments.
> 
> Nigel.
> 
If they are in /etc/fstab, then running "mount -a" should mount
them, unless you are using the noauto option. If you want to be able
to mount it as a user, add the user option. You may want to read the
fstab and mount man pages.

If you do not want to put rules in fstab for them, you could create
a script something like:

#!/bin/bash
#
# Mount partitions for other versions of FC.
#
mount -t ext3 /dev/hdxx /mnt/hdxx
mount -t ext3 /dev/hdxx /mnt/hdxx

and so forth for all the partitions you want to mount. I would
change the names to /mnt/FC1, /mnt/FC3, etc... Also, if you have
partitions for each os besides root, you can add a command to mount
them in the proper place.

mount -t ext3 /dev/hdb5 /mnt/FC6
mount -t ext3 /dev/hdb1 /mnt/FC6/boot

Mikkel
-- 

  Do not meddle in the affairs of dragons,
for thou art crunchy and taste good with Ketchup!




More information about the users mailing list