jump to navigation

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


Comments»

1. ina - October 30, 2005

Great blog!

Hope you can learn some things from mine too!

Ina

2. MilMazz’s Blog » Script para montar/desmontar imágenes ISO desde Nautilus - November 1, 2005

[…] Lea: Nautilus Script to Mount ISO files […]

3. Mount ISO Files With Nautilus at Oakley’s Corner - November 9, 2005

[…] 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. […]

4. Derek Frye - January 5, 2006

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

5. Toby - January 18, 2006

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?

6. allo - March 29, 2006

why are you using a dummy-sudo first? simply use gksudo for the command you want to use …

7. mwarden - May 10, 2006

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

8. Scott - May 30, 2006

The full Nautilus Scripts archive has two contest menu items for burning ISOs.

http://g-scripts.sourceforge.net/nautilus-scripts.tar.gz

9. lul - August 3, 2006

great !! for burning :s this topic is about mounting

10. Julien Deveraux - August 5, 2006

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.?!?

11. clayton winton - November 26, 2006

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’ ? 😉

12. Quintin T. Anderson - December 2, 2006

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?

13. swell - January 27, 2007

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

14. brian.freelancer - May 19, 2007

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.

15. brian.freelancer - May 19, 2007

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

16. Henrik Danielsson - August 14, 2007

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.

17. puimino - September 4, 2007

#!/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

18. Mount ISO Files With Nautilus at hocuspokus - November 14, 2007

[…] to the Ubuntu Blog for the […]

19. Unix Mouth » Nautilus Script to Mount ISO files - November 17, 2007

[…] read more | digg story […]

20. JContest - January 31, 2008

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.

21. Tim - July 2, 2008

No need to mount if you just want to watch an ISO.
Open it with VLC.

22. Mount ISO images with a right click in the Ubuntu file manager (Nautilus) | The Greatest Linux Blog on the Internets. - August 30, 2008

[…] 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 […]

23. Peter Odding - September 3, 2008

@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

24. OSCICYTOK - October 21, 2008

Hello! hydrea

25. maarten - June 14, 2009

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?

26. name - July 29, 2009

Nise site,

27. colorzone - January 12, 2010

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.

28. Making Life Easier With Scripts For Nautilus | Hilltop Yodeler - April 30, 2010

[…] 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 […]

29. porno sikiş - September 27, 2010

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.

30. sex sikiş - September 28, 2010

There’s subtle differences between sudo and gksudo. Some commands are blocking under gksudo while they don’t block under sudo

31. ISO 9000 - October 4, 2011

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

32. freeyoutubedownloadersoftware.wordpress.com - April 28, 2014

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.

33. hırdavat - September 20, 2014

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.


Leave a Reply to swell Cancel reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: