script to disallow mounting of certain idVendor

0

I'm trying to write a script to disallow mounting of certain usb thumb drive's brand like silicon-power my thought was to use tail -f /var/log/messages and grep it to idVendor and blocking it upon detection can sombody help me on this please? im using centos 7 btw.

mike

Posted 2014-12-26T17:43:04.390

Reputation: 11

1Welcome! We're not a script writing service, but can help with specifics.. We just need more info from you.. What have you got so far? Where are you getting stuck exactly? – Ƭᴇcʜιᴇ007 – 2014-12-26T18:27:28.870

thank you, i wrote my code below can you pls help me figure that out? – mike – 2014-12-26T19:45:55.803

Answers

1

Write an udev rule that matches devices by their idVendor attribute (ATTR{idVendor}) and writes 0 to the authorized and/or 1 to remove attributes, causing Linux to eject the device.

(Really, you even tagged your question ...)

user1686

Posted 2014-12-26T17:43:04.390

Reputation: 283 655

i did the udev thing but i couldnt do it right i guess, here is what i wrote: SUBSYSTEM=="usb",ATTR{idVendor}=="[VENDOR ID]", ATTR{idProduct}=="[PRODUCT ID]",ENV{UDISKS_IGNORE}="1" – mike – 2014-12-26T19:43:59.403