Space grey type c USB hub with multiple different ports connected to laptop
Space grey type c USB hub with multiple different ports connected to laptop

How to Install and Set Up USBGuard on Arch Linux

What is USBGuard?

USBGuard is a software framework to protect Linux systems from unauthorized USB devices. It allows you to define policies for USB device access and can help prevent data theft and malware infections via USB ports.

Step 1: Install USBGuard

Open your terminal and run the following command to install USBGuard:

sudo pacman -S usbguard

Step 2: Enable the USBGuard Service

After installation, you need to enable and start the USBGuard service. Run the following commands:

sudo systemctl enable usbguard
sudo systemctl start usbguard

Step 3: Check the Status of USBGuard

To check if the USBGuard service is running, use the following command:

sudo systemctl status usbguard

Step 4: Configure USBGuard

USBGuard uses a configuration file located at /etc/usbguard/usbguard.conf. You can edit this file to customize the behavior of USBGuard:

sudo nano /etc/usbguard/usbguard.conf

In this file, you can set policies for device authorization, logging, and more. Make sure to review the comments in the file for guidance.

Step 5: Authorize USB Devices

When a new USB device is connected, USBGuard will block it by default. You can view the blocked devices and authorize them using the following command:

sudo usbguard list-devices

To authorize a specific device, use:

sudo usbguard allow-device <device_id>

Replace <device_id> with the actual ID of the device you want to authorize.

Step 6: Review USBGuard Logs

USBGuard logs its activities, which can be useful for monitoring. You can view the logs using:

journalctl -u usbguard

Conclusion

USBGuard is now installed and configured on your Arch Linux system. You can manage USB device access and enhance your system’s security against unauthorized USB devices.


This content is free to use, adapt, and share.
Knowledge and information should be open—please spread them far and wide.

A few things to keep in mind:

  • All of my work comes with absolutely no warranty, expressed or implied. However…
  • It will almost certainly work until it breaks,
    though I must admit it may never work or be useful—and that would be sad.
  • If/when it breaks, you can keep all the pieces.
  • As for what you don’t like, it’s yours to do with as you will.
  • If you find my materials helpful, both you and I will be happy (at least for a while).
  • My advice is worth every penny you paid for it!

Full disclosure:
I use various AI systems to assist in developing my content.
If you’re curious about how I use them, feel free to check out:
The Revolutionary Impact of AI on Genealogy and Historical Research.