2

These are the two parts of my query:

  • Is there a way to mount all USB storage/flash/removable storage devices as read-only i.e. set the default mount policy to read-only? Back in Windows OS, I could achieve write-protection for USB storage devices with some registry tweaks. How can I do that in Ubuntu?

  • Using dconf-editor I can control the automount, automount-open, autorun,... (schema: org.cinnamon.desktop.media-handling), but Nautilus will always allow the devices to be mounted in a single click ! I don't want that! So can I control mount options that appear in nautilus under the Devices menu of sidebar? Or is there a better way so that only the Root is able to mount such devices? I tried setting permissions in/to /dev/bus/usb with no luck at all.

1 Answer 1

0

Most USB flash drives are formatted with FAT32. This is a simple filesystem with no journaling or other fancy features. Data is only written if metadata or file contents get modified unless you set the mount policy to read-only. For Linux distributions, you could do this by adding the ro option when manually mounting a partition with the mount program.

You are now looking at desktop programs (Nautilus) which does not use mount directly (it does not even have permissions to do so). It likely uses UDisks instead (actually, udisks2). In the manual page udisks(8) you can find some variables that can be used with udev. To hide a partition from Nautilus for example, have a look at this answer.

I am not aware of an option to set the default mount policy, but you can certainly specify a mount option when manually mounting as root:

udisksctl mount --options ro ...

Changing the permissions of /dev/bus/XXX/YYY is nonsense. Normal users are able to mount external storage because there is a privileged daemon running (udisksd) that operates on behalf of the user.

2
  • Lekensteyn I actually want what I've asked for in my Q to be the default policy in my system; every new devices attached should follow the rules.. (something similar to setting removable devices mount policy to read-only as done in windows where you simply set this policy and go.. every new devices would then be mounted readonly, no extra work needed to be done by hand..)
    – rusty
    Mar 26, 2014 at 8:39
  • 1
    @rusty Unfortunately, that feature is not implemented in udisks. There exists an old patch on bugs.freedesktop.org/show_bug.cgi?id=33461, but not much people seems to be interested. Perhaps you can open a feature request on Launchpad, Martin Pitt is a Ubuntu and Udisks developer so it might get more attention.
    – Lekensteyn
    Mar 26, 2014 at 10:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .