disable USB Ports

Hello. I’m sure there are plenty of apps that I can download, some of which provide a GUI for this, but I want/like to make my own programs… Is there a way, maybe a shell script or an AppleScript that would disable the use of the USB ports and/or any of the other ports on the side of my computer? Any answer will suffice, a 3rd party program, a shell script or an AppleScript… Whatever answer you give me, will be good enough, and I will do my best to use what you have given me.

thanks in advance!

Hi,

the one and only way is to remove the appropriate kext files in /System/Library/Extensions.

But it’s strongly discouraged to do that!

couldnt i technically write an AppleScript to remove/ later re-add the kext file(s)? or can u not re-add them?

Which file(s) are they/ is it and how many are there?

Well, the permissions on the files are too intense that probably, no one in this forum would mess with. I think there are about 2 or 3 default files in that folder, but their can be more. I WOULD NOT DO THIS EVER! Your computer might rely on a hard drive connected via USB, so you could crash something at that. Why are you doing this? Maybe there is another way, instead of disabling USB overall.

That’s not trivial.
All these files belong to the system respective the root user and
after adding/removing files in the extensions folder the computer must be rebooted to apply the changes.

ok, I guess you guys are probably right, these files are too important to mess with… maybe there is an alternative… ok, I need to temporarily disable the USB ports, because I use a communal computer, and I am worried that thumb drives are being plugged in and my files, which are somewhat private, are being copied off… is there a way aside from disabling the USB ports in that very dangerous way to do this?

OS X provides some convenient features like parental controls or managed user accounts

If you really want to do this, see:
http://images.apple.com/server/macosx/docs/Leopard_Security_Config_20080530.pdf

pages 47-49 (“Preventing Data Port Access”)

Basically, removing “IOUSBMassStorageClass.kext” from /System/Library/Extensions will prevent USB storage devices from mounting, while allowing your keyboard and mouse to still work. There is also an instruction for removing Firewire access. I would MOVE those files into a “Disabled” folder rather than delete them. That will make is easier to undo. That assumes that your users aren’t power users who would know how to undo the change themselves…

I can confirm that this will not make your Mac wack out. Our entire Mac department has this applied (it is against our company policy to use USB storage devices under any circumstance).

Having said that, I agree that the simplest solution would be to keep your files under your account, and then make everyone else log in under a “Guest” account so they can’t get to your files. Don’t leave the computer up and running logged in under your account.