Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

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.

share|improve this answer
    
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 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 at 10:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.