note: I don't want to use a udev rule.
I need to change (programmatically) the permissions of some device. To understand what I have to do (in code) I want to do this using just chmod command.
So far, I've tried this:
root# ls -l /dev/sdb
brw-rw-rw- 1 root disk 8, 16 Apr 7 05:27 /dev/sdb
root# chmod 0600 /dev/sdb
root# ls -l /dev/sdb
brw------- 1 root disk 8, 16 Apr 7 05:27 /dev/sdb
as you can see, /dev/sdb has read and write permissions only for the owner (root). But I'm still able to create new files and read files from my connected flash drive.
What am I missing? How can I use chmod to prevent users from writing to some device?