Re: Write protect access on USB port
<berenger.morel <at> neutralite.org> writes:
> 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.
Yes the above would work in most cases but in the case I am dealing
with, the filesystem is not mounted yet. For example, I plug in a USB
drive. Before it is mounted, there is a /dev/sd[x] node. I can open
this node and write anything I want, thereby corrupting the filesystem
on that device.