Nautilus Script to Mount ISO files October 24, 2005
Posted by Carthik in ubuntu.trackback
David Carney, subscriber to the ubuntu-users mailing list had shared the following script to enable mounting ISO cd images from within the Nautilus File Manager, by right-clicking on the iso file to be mounted. You have to create a /media/ISO directory before you can use the script. For more details on how to install scripts for Nautilus, read the How to Install a Script part of the g-scripts faq.
I quote the entire mounting and unmounting script below:
MOUNT ISO FILES:
#!/bin/bash
#
for I in `echo $*`
do
foo=`gksudo -u root -k -m "enter your password for root terminal
access" /bin/echo "got r00t?"`
sudo mount -o loop -t iso9660 $I /media/ISO
done
done
exit0
UMOUNT ISO FILES:
#!/bin/bash
#
for I in `echo $*`
do
foo=`gksudo -u root -k -m "enter your password for root terminal
access" /bin/echo "got r00t?"`
sudo umount $I
done
done
exit0
Great blog!
Hope you can learn some things from mine too!
Ina
[…] Lea: Nautilus Script to Mount ISO files […]
[…] Found a great little post over at the Ubuntu Blog on WordPress.com detailing two short bash scripts that allow you to mount and unmount an ISO image easily. […]
You’re the first hit on google for “nautilus script mount iso”.
I was hoping to find something a little more feature complete (like the same script to mount/umount).
I ended up writing it myself:
#!/bin/bash
if (/usr/bin/gksudo -u root -k -m “enter your password to gain root privleges” /bin/echo “getting root”); then
for i in `/bin/echo $*`; do
if (/bin/mount | /bin/grep “$i”); then
# disk is mounted, umount
if ! (/usr/bin/sudo /bin/umount /mnt/”$i” && /usr/bin/sudo /bin/rmdir /mnt/”$i”); then
/usr/bin/zenity –error –text=”cant umount /mnt/$i and/or rmdir /mnt/$i”
exit 1
fi
else
# disk isn’t currently mounted
if ! (/usr/bin/sudo mkdir /mnt/”$i” && /usr/bin/sudo /bin/mount -o ro,loop -t iso9660 “$i” /mnt/”$i”); then
/usr/bin/zenity –error –text=”can’t mkdir /mnt/$i and/or mount $i”
exit 1
fi
fi
done
exit 0
else
exit 1
fi
My gksudo seems to be broken. Any ideas? When I try to launch anything requiring root access, I get the following:
Cannot launch entry
Details: Failed to execute child process “gksudo” (No such file or directory)
I’ve been using RedHat since veriosn 5, Fedora since its inception, and SuSE for the last year, and always used GNOME more then KDE, and I have, in these seven years, never seen this message before. Any thoughts (besides changing distros, which I won’t be doing because of work and time)?
I love the thought of Right-click -> Mount ISO, but so far no luck. I’m sure it’s because gksudo is broken. Currently using SuSE 10. I know it has something to do with my user profile. I just created a new user and launched an app requiring root, supplied the password, and the app opened. What’s my next step?
why are you using a dummy-sudo first? simply use gksudo for the command you want to use …
this didn’t work for me. i had to do this:
#!/bin/bash
quoted=$(echo -e “$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS” | awk ‘BEGIN {
FS = “\n” } { printf “\”%s\” “, $1 }’ | sed -e s#\”\”##)
foo=`gksudo -u root -k -m “enter your password for root terminal access” /bin/echo “got r00t?”`
eval “sudo mount -o loop -t iso9660 “$quoted” /media/ISO”
exit 0
and for unmounting:
#!/bin/bash
quoted=$(echo -e “$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS” | awk ‘BEGIN {
FS = “\n” } { printf “\”%s\” “, $1 }’ | sed -e s#\”\”##)
foo=`gksudo -u root -k -m “enter your password for root terminal access” /bin/echo “got r00t?”`
eval “sudo umount $quoted”
exit 0
The full Nautilus Scripts archive has two contest menu items for burning ISOs.
http://g-scripts.sourceforge.net/nautilus-scripts.tar.gz
great !! for burning :s this topic is about mounting
i used the script that is at the top, on Ubunt Dapper. Images will mount but won’t unmount. Unmounting yields and error about the device not being in FSTAB and that i’m not root.?!?
Two harddrives.
One with RedHat Ent WS3
The other with Ubuntu5.1
Neither will allow file access of the other.
The RedHat is partitioned in 3 parts, all primaries, Ext3 and swap.
The Ubuntu is paritioned with LVMM and data is stored in the extension, partition 5, which exists inside the primary partition #2. Parition 1 is readable by either filesystem, RedHat or Ubuntu, and mountable with no access to the root filesystem.
Why can’t ‘root’ read ‘root’ ? 😉
i’m trying to unmount and mount an iso files, but I know nothing about computers. I was reading this blog and I have no idea whats going on.
Is there anyone who could possibly explain this process in a very simple way?
i have the same problem…
bug list:
1. can see the files from the virtual cd (iso) but cannot read them
2. can’t unmount
hop3 this gets better
I found this one and it worked great for me!
It’s made for debian though and, as a no0b I’m not aware if there will be conflicts with Ubuntu.
there’s just a slight problem with the line:
“sudo mv ~/mount-iso ~/.gnome2/nautilus-scripts/”
which should be:
“sudo mv ~/mount.sh ~/.gnome2/nautilus-scripts/”
unless you changed the file names. hope it helps someone…by the way, I have Ubuntu Edgy Eft.
ehehe…I forgot to put the URL on the last one..here it is! 🙂
http://www.debianadmin.com/mount-and-unmout-iso-images-without-burning-them.html
Derek Frye -> Awsome script! This taught me a lot about scripting in Linux =)
To anyone else trying it, don’t forget to replace all the double-quotes in the strings with new ones. They are messed up by the formatting and won’t work as is.
#!/bin/bash
drolitas=”$HOME/Rolitas/Iso-$(basename ${1})”
if [ -d “${drolitas}” ] ;then
gksudo -S -u root -k -m “Eit!!” /bin/echo “got r00t?”
sudo /bin/umount “${drolitas}”
else
mkdir -p “${drolitas}”
gksudo -S -u root -k -m “Eit!!” /bin/echo “got r00t?”
sudo /bin/mount -oloop “${1}” “${drolitas}”
fi
[…] to the Ubuntu Blog for the […]
[…] read more | digg story […]
Hey, if you are into contests there is a great contest on YouTube for Valentines Day. The contest is to create a video for the holiday. Actually its two contests, one is to make a video talking about your great love and the second is to actually do an online video proposal called “Will You Marry Me?” Here’s the URL http://www.youtube.com/greatestlovestories?cm_cid=twb8. Right now there are very few entries so you might have a good shot at winning.
No need to mount if you just want to watch an ISO.
Open it with VLC.
[…] recently discovered a handy script for Nautilus to mount an ISO image using the right click context menu. It’s a handy feature that lets you quickly peek inside an iso CD/DVD image (in read-only […]
@allo:
> why are you using a dummy-sudo first?
> simply use gksudo for the command you want to use …
There’s subtle differences between sudo and gksudo. Some commands are blocking under gksudo while they don’t block under sudo… This caused me quite a headache actually, I’ve had to resort to the following to open an IMAP tunnel using gksudo:
gksudo -D /usr/share/applications/thunderbird.desktop touch /tmp/imap-tunnel-exists
if [ -e /tmp/imap-tunnel-exists ]; then
sudo rm /tmp/imap-tunnel-exists
sudo ssh -fL 143:localhost:143 xolox.ath.cx sleep 10
…
fi
Hello! hydrea
can somebody help me?
i downloaded black and white but it was an iso file..
i mounted it or something and now it said’s that it’s not the correct cd..
what now?
Nise site,
How to Mount iso? http://www.winmount.com/mount_iso.html
Winmount(www.winmount.com) is a powerful windows utility which is dedicated to managing files and disks impressively and conveniently. WinMount supports compressing files to MOU RAR ZIP 7Z, decompressing and browsing MOU ZIP RAR CAB ARJ ISO GZ BZ2 TAR WIM files.
WinMount can mount MOU RAR ZIP to a virtual disk or a local folder, which enabling you to use the files inside directly without extraction, saves your time and disk space dramatically.
WinMount is also an image tool, supports mounting ISO ISZ BIN MDS/MDF NRG IMG CCD CUE to virtual DVD-ROM, supports mounting FLAC, APE, WV, WAVE to virtual CD-ROM, supports mounting VHD, VDI, VMDK, WMT, Microsoft WIM, and folder as a HDD virtual disk.
In addition, WinMount can create a new blank RAM-disk, size from 64M to 4G, data will be lost when restart.
[…] on occasion are for mounting and unmounting an ISO file. Although there are other methods listed here and here, and likely even more here, I have had good luck with the mount.sh and unmount.sh files […]
WinMount can mount MOU RAR ZIP to a virtual disk or a local folder, which enabling you to use the files inside directly without extraction, saves your time and disk space dramatically.
There’s subtle differences between sudo and gksudo. Some commands are blocking under gksudo while they don’t block under sudo
I appreciate your post. I also wrote that SMS advertising provides a cost effective method of targeting promotions to specific customer profiles. You might want to remind customers of specific events or promotions, but for whatever reasons, SMS allows you to pass information directly to the right customer at very affordable prices and fast delivery.
iso 9000
Hmm it appears like your website ate my first comment
(it was super long) so I guess I’ll just sum it up what I submitted and
say, I’m thoroughly enjoying your blog. I as well am an aspiring blog writer but I’m still
new to the whole thing. Do you have any suggestions for rookie blog writers?
I’d really appreciate it.
It happens to be a pleasant plus very helpful part of data. I’m glad that you just shared this beneficial information around. Make sure you continue being us all updated this way. Appreciate expressing hırdavat.