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
  • 69,112

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,155
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
  • 104,119