Re: Write protect access on USB port
Le 26.11.2012 22:28, Amit a écrit :
<berenger.morel <at> neutralite.org> writes:
You can enable read-only on partitions by using the "ro" flag in
# <file system> <mount point> <type> <options> <dump>
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.
Thanks for the reply. I was looking for block level write protect.
is, nobody can write a simple C program and use the open call and
garbage to the device.
If a partition is mounted as read-only, I think no software will be
able to write on it, because the kernel is responsible of what will
happen. Low level open&close functions just call kernel's API, so if the
kernel refuse writings, I can not see a solution to write.
But I am not a kernel expert, I always prefer the standard C/C++
functions instead of OS's dependent low-level feature.