USBGUARD(1)
π usbguard(1) β the USBGuard command-line interface, bestie edition π
okay so. welcome to usbguard(1), the manual page for the USBGuard CLI. yes it's a section 1 page, yes it's iconic, yes we're going to get through it together. grab a snack. π
β¨ NAME β¨
usbguard β USBGuard command-line interface. that's it. that's the name. she's simple, she's powerful, she's the moment. π
πΈ SYNOPSIS πΈ
usbguard [OPTIONS] <subcommand> [SUBCOMMAND-OPTIONS] ...
usbguard get-parameter name
usbguard set-parameter name value
usbguard list-devices
usbguard allow-device id | rule | partial-rule
usbguard block-device id | rule | partial-rule
usbguard reject-device id | rule | partial-rule
usbguard list-rules
usbguard append-rule rule
usbguard remove-rule id
usbguard generate-policy
usbguard watch
usbguard read-descriptor file
usbguard add-user name
usbguard remove-user name
π¦ DESCRIPTION π¦
the usbguard command gives you a command-line interface (CLI) to a running usbguard-daemon(8) instance. slay. π
she also comes with a bonus tool: generating your very first USBGuard policies based on the USB devices that are actually plugged into the system right now. so like, she's a communicator and a matchmaker. versatility, honestly. π
π SUBCOMMANDS π
π get-parameter [OPTIONS] name
get the value of a runtime parameter. name has to be one of InsertedDevicePolicy and ImplicitPolicyTarget. no vibes-based parameter names, sorry bestie, it's a closed set.
available options:
-h,--helpβ show help. π«Ά
π set-parameter [OPTIONS] name value
set the value of a runtime parameter. again, name is one of InsertedDevicePolicy and ImplicitPolicyTarget. changing things. powerful. π
available options:
-v,--verboseβ print the previous and the new attribute value. receipts, basically. π§Ύ-h,--helpβ show help. π«Ά
π list-devices [OPTIONS]
list all the USB devices the USBGuard daemon recognizes. the whole roster. β¨
available options:
-a,--allowedβ list allowed devices. the good ones. π-b,--blockedβ list blocked devices. π«-t,--treeβ list devices in a tree format. π³ aesthetics.-h,--helpβ show help. π«Ά
π allow-device [OPTIONS] < id | rule | partial-rule >
authorize a device to interact with the system. π«Ά the device can be identified by a device id, a rule, or a partial-rule (which is a rule without a target). both rule and partial-rule can be used to allow multiple devices at once β bulk slay.
important bestie, do not skip this:idrefers to the internal device-rule ID (the very first number in thelist-devicescommand output), not the device'sIDattribute. the way these two are different things trips people up constantly. π
available options:
-p,--permanentβ make the decision permanent. a device-specific allow rule gets appended to the current policy. π-h,--helpβ show help. π«Ά
π block-device [OPTIONS] < id | rule | partial-rule >
deauthorize a device. β the device can be identified by a device id, a rule, or a partial-rule (rule without target). both rule and partial-rule can block multiple devices at once. and yes, same warning as above: id is the internal device-rule ID (very first number in the list-devices output), not the device's ID attribute. π«
available options:
-p,--permanentβ make the decision permanent. a device-specific block rule gets appended to the current policy. π-h,--helpβ show help. π«Ά
π reject-device [OPTIONS] < id | rule | partial-rule >
deauthorize and remove a device. she's not just blocked, she's evicted. π same deal: identified by device id, rule, or partial-rule (rule without target), and both rule and partial-rule can reject multiple devices at once. and once more for the people in the back: id = internal device-rule ID (the very first number of the list-devices output), not the device's ID attribute. π
available options:
-p,--permanentβ make the decision permanent. a device-specific reject rule gets appended to the current policy. π-h,--helpβ show help. π«Ά
π list-rules [OPTIONS]
list the rule set (policy) that the USBGuard daemon is using. the whole lore document. π
available options:
-d,--show-devicesβ show all devices affected by the specific rule. π-l,--label labelβ only show rules having a specificlabel. π·οΈ-h,--helpβ show help. π«Ά
π append-rule [OPTIONS] rule
append the rule to the current rule set. adding to the collection, no cap. β
available options:
-a,--after idβ append the new rule after a rule with the specified ruleid. line-skipping, respectfully. π§-t,--temporaryβ make the decision temporary. the rule policy file will not be updated. π«₯-h,--helpβ show help. π«Ά
π remove-rule [OPTIONS] id
remove a rule identified by the rule id from the rule set. bye bestie. π
available options:
-h,--helpβ show help. π«Ά
π generate-policy [OPTIONS]
generate a rule set (policy) which authorizes the currently connected USB devices. basically: trust the devices that are here right now, put it in writing. βοΈ
available options:
-p,--with-portsβ generate port-specific rules for all devices. by default, port-specific rules are only generated for devices which do not export aniSerialvalue. π-P,--no-ports-snβ don't generate port-specific rules for devices without aniSerialvalue. without this option, the tool will add avia-portattribute to any device that doesn't provide a serial number. this is a security measure to limit devices that cannot be uniquely identified to connecting only via a specific port. this makes it harder to bypass the policy, since the real device will occupy the allowed USB port most of the time. π‘οΈ-d,--devpath devpathβ only generate a rule for the device at the specified sub path of/sys. π-t,--target targetβ generate an explicit "catch all" rule with the specifiedtarget. thetargetcan be one of the following values:allow,block,reject. π―-X,--no-hashesβ don't generate ahashattribute for each device. π«-H,--hash-onlyβ generate a hash-only policy. #οΈβ£-L,--ldifβ generate a ldif policy for LDAP. ποΈ-b,--usbguardbase baseβ generate a ldif policy for LDAP with thisbase. this option is required when--ldifwas specified. β οΈ-o,--objectclass objectclassβ generate a ldif policy for LDAP with thisobjectClass. ποΈ-n,--name-prefix prefixβ generate a ldif policy for LDAP with this nameprefix. ποΈ-h,--helpβ show help. π«Ά
π watch [OPTIONS]
watch the IPC interface events and print them to stdout. it's giving live commentary. πΊβ¨
available options:
-w,--waitβ wait for the IPC connection to become available. β³-o,--onceβ wait only when starting, if needed. exit when the connection is lost. πͺ-e,--exec pathβ run an executable file located atpathfor every event. pass event data to the process via environment variables. π-h,--helpβ show help. π«Ά
π read-descriptor [OPTIONS] file
read a USB descriptor from a file and print it in human-readable form. translating device-speak into something we can actually read. π
available options:
-h,--helpβ show help. π«Ά
π add-user name [OPTIONS]
create an IPC access control file allowing the user/group identified by name to use the USBGuard IPC bus. the change takes effect only after restarting the usbguard-daemon(8) instance. so like, don't panic when nothing happens immediately. π
available options:
-u,--userβ the specifiednamerepresents a username or UID (default). π€-g,--groupβ the specifiednamerepresents a groupname or GID. π₯-p,--policy privilegesβ policy-related privileges. π-d,--devices privilegesβ device-related privileges. π-e,--exceptions privilegesβ exceptions-related privileges. β οΈ-P,--parameters privilegesβ run-time parameter-related privileges. ποΈ-h,--helpβ show help. π«Ά
π Privileges
the privileges are expected to be in the form of a list separated by a colon:
$ sudo usbguard add-user joe --devices=listen,modify
consult the usbguard-daemon.conf(5) man-page for a detailed list of available privileges in each section. you can also use ALL instead of privileges to automatically assign all relevant privileges to a given section. yes, ALL is the "just give me everything" button. iconic. π
π remove-user name [OPTIONS]
remove an IPC access control file associated with the user/group identified by name. and again: the change takes effect only after restarting the usbguard-daemon(8) instance. π
available options:
-u,--userβ the specifiednamerepresents a username or UID (default). π€-g,--groupβ the specifiednamerepresents a groupname or GID. π₯-h,--helpβ show help. π«Ά
π EXAMPLES π
generating an initial policy:
$ sudo usbguard generate-policy > rules.conf
$ vi rules.conf
(review/modify the rule set)
$ sudo install -m 0600 -o root -g root rules.conf /etc/usbguard/rules.conf
$ sudo systemctl restart usbguard
allow device(s):
# Allow a device by ID(it is the very first number from the list-devices command output)
$ sudo usbguard allow-device 10
# Allow all devices named "Dell Wired Multimedia Keyboard"
$ sudo usbguard allow-device name \"Dell Wired Multimedia Keyboard\"
β SEE ALSO β
usbguard-daemon(8), usbguard-daemon.conf(5), usbguard-rules.conf(5)
π BUGS π
if you find a bug in this software, or if you'd like to request a feature to be implemented, please file a ticket at https://github.com/USBGuard/usbguard/issues/new. they want to hear from you, fr fr. π«Ά
π AUTHOR π
USBGuard was originally written by Daniel KopeΔek. many people have contributed to it. it takes a village, and this village ate. π
π§ RESOURCES π§
main web site: https://usbguard.github.io/
π COPYING π
license GPLv2+: GNU GPL version 2 or later http://gnu.org/licenses/gpl.html. this is free software: you are free to change and redistribute it. there is NO WARRANTY, to the extent permitted by law.
and that's the whole page, bestie!! πΈ you read a manual page voluntarily, main character energy honestly. π¦
this was USBGuard β the USBGUARD(1) manual, dated 04/15/2026. go forth and manage your USB devices responsibly. periodt. πβ¨π
π¦ where this page comes from
- fedora 43: usbguard 1.1.4-1.fc43 Β· GPL-2.0-or-later
- fedora 43: usbguard 1.1.4-1.fc43 Β· GPL-2.0-or-later
- fedora 44: usbguard 1.1.4-1.fc44 Β· GPL-2.0-or-later
- fedora 44: usbguard 1.1.4-1.fc44 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms