A Facebook user asked how to forbid write access to an external USB drive, allowing only for read-only access:


My very first idea was to use udev rules:

Create a file /etc/udev/rules.d/90-ro-usb.conf:

and reload udev:

To enforce read-only mounting of all removable drives (taken from RedHat Security Guide):

Other solutions (I have not tested them myself):

Instead of blockdev, you can use hdparm: RUN+="/sbin/hdparm -r1 /dev/%k"

How to Enforce Read-Only Mounting of USB Drives
Tagged on:         

Leave a Reply

Your email address will not be published. Required fields are marked *