4

I have a backup external USB drive.

I wonder how to tell the system to always mount it read only without explicitly telling him everytime

sudo mount -o ro /dev/sde1 /media/backup

Note: My drive is not always attached to the system. I only attach it when I need something important from the backup. So I don't want't to edit ftsab and when booting up it tells me that it has failed to mount drive because it doesn't exist

Braiam
  • 67,791
  • 32
  • 179
  • 269
kirchberger
  • 834
  • 1
  • 7
  • 17

2 Answers2

7

One method for doing this would be to explicitly set the mount options through the disks GUI.

Step #1

                                       ss #1

Step #2

Navigate to the USB HDD.

      ss #2

Step #3

Select the partition on the USB HDD you'd like to have mounted read only.

                          ss #3

Step #4

  1. From the next window that you get, move the button to the left, under the option ‘Automatic Mount Options’, to get access to the settings.
  2. Now, remove the check-mark under the option ‘Mount at startup’. You can let it stay enabled too, but I prefer to let Nautilus (file manager) mount the partitions, after the desktop is loaded, to speed up the boot-up process.
  3. Then, as shown in the below screenshot, you will see a field that says nosuid,nodev,nofail,x-gvfs-show.

Now all you have to do is, simply copy and paste the below code, and add (paste) it to the end of that text line (without a space). This will make the HDD mounted read only:

,ro

         ss #4

Step #5

Once done, click on the ‘OK’ button at the bottom, when asked enter your administrative password, and now you are done!.

Now try opening the partition in Nautilus (or any utility) and you will notice that you no longer can ‘Cut’ or ‘Delete’ files inside it, as it is mounted with read-only permissions.

To disable it later, you wanted to re-enable the read-write support, then simply remove that manually added ,ro code (or, you can also move that top button to the right side, until you see the option ‘ON), and save your changes. That's it!.

Source: How to Easily make ‘NTFS’ Partitions read-only in Ubuntu 12.10?

slm
  • 3,035
  • You are awesome. I have a pc with ubuntu 12.10 and your answer is a great fir with it. But my main pc is ubuntu 12.04 and I have the old disk utility that doesn't have these mount options :( – kirchberger Mar 15 '14 at 06:01
  • +1 for 13.10 But I have ubuntu 12.04 – kirchberger Mar 15 '14 at 06:41
  • @kirchberger - wish I'd known that, I figured you had 12.10 at least. Oh well.... – slm Mar 15 '14 at 12:12
3

You can still set this up using fstab, just don't set it to be mounted automatically. Get the UUID of your drive (you can use blkid for that) and add this line to your /etc/fstab:

UUID=123-ABC   /media/backup  ntfs   ro,noauto,users   0   0

Change the UUID for whatever your's is and the ntfs to your filesystem. Now, the drive won't be mounted automatically (noauto) but it can be mounted manually by a normal user with:

mount /media/backup

To make this work automatically in nautilus, use this line in /etc/fstab instead (thanks @Braiam):

UUID=123-ABC /media/backup auto noauto,nosuid,nodev,nofail,x-gvfs-show,ro 0 0
terdon
  • 100,812
  • ok it works from terminal but not from nautilus. the error is: Unprivileged user can not mount NTFS block devices using the external FUSE library. Either mount the volume as root, or rebuild NTFS-3G with integrated FUSE support and make it setuid root. – kirchberger Mar 14 '14 at 17:58
  • @kirchberger see updated answer, this one should work on 12.04. – terdon Mar 15 '14 at 18:58
  • x-gvfs-show is giving me a stuck ubuntu boot! – kirchberger Mar 19 '14 at 16:23
  • @kirchberger try adding noauto as well (see updated answer). It is probably stuck because it is expecting the disk to be present. – terdon Mar 19 '14 at 16:32