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.

rusty
  • 16,917

1 Answers1

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.

Lekensteyn
  • 178,446