Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Howto mount iso as non-root user
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
psy_ill
Tux's lil' helper
Tux's lil' helper


Joined: 06 Jul 2003
Posts: 106

PostPosted: Fri May 20, 2005 9:11 am    Post subject: Howto mount iso as non-root user Reply with quote

I've seen this topic on other threads, but noone solved it exactly as I think it should be done, so here comes the full procedure:

  1. Make sure you have enabled the loopback device in kernel
  2. If you choose to compile the loopback device as a module, you need to make sure it loads at bootup
  3. Add the following rows to your /etc/fstab:
    Code:

    # To mount .iso-files
    /tmp/cdimage/tmp.iso    /mnt/iso    iso9660    noauto,ro,user,loop    0 0

  4. Create the directory /tmp/cdimage
  5. Put the following two scripts somewhere in your $PATH:
    isomount.sh
    Code:

    #!/bin/bash

    MOUNTFILE="$1"
    # Convert relative paths to absolute
    MOUNTFILE=$(cd `dirname "$MOUNTFILE"` && pwd)"/"`basename "$MOUNTFILE"`
    MOUNTLINK="/tmp/cdimage/tmp.iso"

    ln -sf "$MOUNTFILE" "$MOUNTLINK"
    mount "$MOUNTLINK"

    isoumount.sh
    Code:

    #!/bin/bash

    MOUNTLINK="/tmp/cdimage/tmp.iso"

    umount "$MOUNTLINK"
    rm "$MOUNTLINK"

  6. Set the file mode for the scripts so that you can execute them

Done! With the command
Code:

isomount.sh foo.iso

the iso-file foo.iso will be mounted at /mnt/iso and with the command
Code:

isoumount.sh

it will be unmounted.
Back to top
View user's profile Send private message
anima1
n00b
n00b


Joined: 27 Dec 2004
Posts: 1

PostPosted: Fri May 20, 2005 9:42 am    Post subject: hmm Reply with quote

nice try, but how does it work when two users mount iso at the same time?
Back to top
View user's profile Send private message
psy_ill
Tux's lil' helper
Tux's lil' helper


Joined: 06 Jul 2003
Posts: 106

PostPosted: Mon May 23, 2005 10:36 am    Post subject: Reply with quote

Since /tmp has the sticky bit set, only the user who created the softlink can remove it. So it does not matter if another user tries to create the softlink before the mounting fails, the softlink creation will fail too.

It will be like when another user tries to mount a cd which is already mounted. I understand your opinion though, because a cd must be considered as one limited resource but different iso-files should be mountable at the same time. It's still hard though to create mountpoints on-the-fly in /etc/fstab.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum