0

How can I check using a script that CD-drive is connected to USB port?

I don't want to allow cd-rom to be used as usb device under any circumstance in my system. Is there a way to check this?

network
  • 33
  • Open up all computers, unsolder USB ports, done. (Don't try to "block USB" in software - someone will find a backdoor). – dirkt Feb 17 '20 at 14:27
  • Could you clarify what you mean by “cd rom can be used as a usb device”? – Stephen Kitt Feb 17 '20 at 14:54
  • I remember that in windows when you use a cd for the first time it asks if you want to use it as a usb or as a flash drive..So if you choose the usb mode it will be equivalent to a pendrive.. – network Feb 17 '20 at 14:57
  • What? What is a hard-drive by USB? What is USB mode vs flash drive mode of a CD? What What What, this makes no sense to me. Please edit question, remove all jargon, use plain English. – ctrl-alt-delor Feb 17 '20 at 18:13
  • @ctrl-alt-delor check this out https://helpdeskgeek.com/wp-content/pictures/2009/05/how-to-use-disc.png Now how to ensure that the disc inserted to my computer is never working in usb mode but data would be burned to it – network Feb 17 '20 at 18:19
  • OK. So it was not use that made up this confusing and incorrect terminology. However you did change it. The text in that image is not referring to USB connectivity. It is talking about creating disks that can be changed after writing. It is not clear which of at least 2 methods (re-writable disks, or appending to write once disks (multi session)). Are you just wanting it so that people can not append to the disk, or otherwise change it? Are you saying that you want to make it impossible to create such a modifiable disk? What are you trying to protect from? – ctrl-alt-delor Feb 17 '20 at 18:36
  • My understanding of the Windows screenshot is: "do you want to format as UDF or as ISO 9660?" The comment completely changes the meaning of the question. There's already one answer that I would have done similarly because there's no way to understand the question otherwise, which must change its topic (or not? did I get it wrong?). Please edit the question. – A.B Feb 17 '20 at 19:24
  • That has nothing to do with the CD being connected to an USB port, but with it being able to be written incrementally by the OS, without having to use specialized "burner" software like Nero or whatever. If you don't want your CD to be modified, use a CD-R, and close the last-session when burning it. –  Feb 18 '20 at 21:58
  • 1
    Where does this strange requirement come from? An XY problem perhaps? – vonbrand Feb 19 '20 at 18:15

1 Answers1

2

I would use USBGuard for this,

The USBGuard software framework helps to protect your computer against rogue USB devices (a.k.a. BadUSB) by implementing basic whitelisting and blacklisting capabilities based on device attributes.

I would then create a whitelist of device IDs that are allowed to be used, and block everything else.

See: https://usbguard.github.io/documentation/rule-language.html

oxr463
  • 1,240