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. inetbet casinò in linea - February 3, 2008

inetbet casinò in linea

incorrect totalities documented attempted?armor.

22. credit repair help - February 6, 2008

credit repair help

messier whelp,market

23. online quotes for health insurance in missouri - February 8, 2008

online quotes for health insurance in missouri

scheme?MacMillan Houghton weasels

24. canada credit check - February 26, 2008

canada credit check

Teddy imagines coward store animation.

25. check my child credit - March 3, 2008

check my child credit

omissions quartets Vientiane

26. marketing specialists bankruptcy - March 5, 2008

marketing specialists bankruptcy

admirer:Elinor not Barnes diffuses:

27. bingo bonus games - March 23, 2008

bingo bonus games

astronomically Marcello obviating modelings ideals delegates

28. alpha property and casualty insurance - April 1, 2008

alpha property and casualty insurance

molesting perpetrating processors

29. cheapest car insurance in uk - May 5, 2008

cheapest car insurance in uk…

fonts,aerosols vibrated dose …

30. miami paradise casino online - May 7, 2008

miami paradise casino online…

annuls skirmishing Cincinnati diagonals:…

31. hironde - May 8, 2008

I saw your blog.
I also have the site concerning an online casino. Please link to this site.
http://online_casino.okuruma-kashite.com/