[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Write protect access on USB port

You can enable read-only on partitions by using the "ro" flag in fstab.

By example:
# <file system> <mount point>   <type>  <options>       <dump>  <pass>

proc	/proc	proc	defaults	0	0
#Entry for /dev/sda6 :
UUID=85bb1632-546f-460f-8cc7-5b15fd2c046b	/	ext4	noatime,errors=remount-ro	0	1

Here, / will be mounted with read-only if there were errors. I guess that if you just remove the "errors=" it will be ro everytime.
Hope it helps.

Le 26.11.2012 21:03, Amit a écrit :

I would like to block write access by default to all drives plugged in to my USB port (a specific USB port). This capability would probably be
at the kernel level to be effective.

Doing research on LWN.net, I noticed the following sentence by Corbet:


Enforcing read-only: The block layer has a mechanism by which a driver can mark a specific device (or partition) as being read-only. This flag may be set if the physical device is write-locked; it can also be set by
higher-level code (the DM or MD layers, for example) when the
administrator creates a read-only device.

Any idea on how this is done?


Reply to: