3 ms·
I want to disable my USB controller so after every boot, I am forced to open terminal, type Sudo -s , give password and unbind the USB. Is there a way to auto
by 2Gkashmiri 5y ago
I want to disable my USB controller so after every boot, I am forced to open terminal, type
Sudo -s , give password and unbind the USB.
Is there a way to automate this as a shell script without having to type the password?
I assume
Sudo -s | password | unbind string but that doesn't work.
- Hackbraten 5y agoYou want to use your service manager for that kind of tasks. For example, systemd or sysvinit on Linux, or launchd on macOS.
- kafkaIncarnate 5y agoLook into NOPASSWD in the sudoers manpage. You can just put the code in a script then give %wheel (or whomever) NOPASSWD access to run it. This can also be thrown in sudoers.d for ease of copying and managing config across machines.
- jacob019 5y agouse an rc.local script
- sp332 5y agoYou can configure udev to blacklist the device. https://projectgus.com/2014/09/blacklisting-a-single-usb-device-from-linux/ https://projectgus.com/2014/09/blacklisting-a-single-usb-dev...
- qbasic_forever 5y agoYep, do this OP... don't try to hack in some automated script that now has a race condition with device setup. udev has a ton of hooks for enabling, disabling and doing anything when device state changes.