Restrict USB on (Fedora) Linux

Hey everyone!
Is there a program or extension that can be installed on Fedora 36 / Linux in general where you have to explicitly allow any USB device that’s plugged in? A bit like the new MacOS security update that came with Ventura.

image

Thanks in advance! :orange_heart:

Did you mean a program to allow or deny specific USB devices? I think that is the TLP.

TLP - USB
https://linrunner.de/tlp/settings/usb.html
https://wiki.archlinux.org/title/TLP

To install on Fedora

# dnf install tlp

Edit: Sorry I was wrong. It seems that it controls USB devices to apply the auto-suspend mode.

Exclude USB device IDs from autosuspend mode. Useful for devices having difficulties in waking up from autosuspend. Use tlp-stat -u to determine IDs. Multiple IDs are separated with blanks.

Actually TLP will only prevent the device from suspending, it wont block it.

If you go to Settings → Removable Media you can set what it does when you add media to the device.

Additionally by using the dconf Editor you can search for automount and turn one or both settings off. This will prevent automatic mounting of USB devices.

2 Likes

I’ve used https://usbguard.github.io/ in the past for this. There’s also GitHub - Cropi/usbguard-notifier: A tool for detecting usbguard policy and device presence changes to show notification prompts when a device is plugged in. I believe both are available in Fedora’s repos.