USB Device is not authorized for usage
I am using the newest Ubuntu 20.04, and all software were updated.
After installation of system, U disk can be used without any problem. After installation of many other software, U disk can not be recognized. I am sure the driver was installed. When I run "lsusb
", I can find the usb disk
Bus 001 Device 005: ID 0951:1666 Kingston Technology DataTraveler 100 G3/G4/SE9 G2
When I run "dmesg
", it shows
[241620.374470] usb 1-1.3: Device is not authorized for usage
[241637.411899] usb 1-1.3: USB disconnect, device number 4
I edited the "org.freedesktop.devicekit.udisks.policy
", change "allow_any
" to yes and still not work!
Later, I found the problem is that usbguard blocks the usb-device.
Find out the id of device by "usbguard list-devices
" and use "usbguard allow-device XX
". But how can it work automaticly?
Solution 1:
If you have usbguard and it blocks devices that you want to use, you can use the usbguard
tool to add them to allowed list. Run usbguard
and you should get some fairly clear instructions.
usbguard list-devices # optionally --blocked
Should give you a listing of connected devices and whether they are allowed or blocked. You can pick an id (first number) and run e.g.
usbguard allow-device -p 17 # allow-device [OPTIONS] <'id' | rule>
-p
,--permanent
Make the decision permanent. A device specific allow rule will be appended to the current policy.
and should see the change in journal:
kernel: usb 1-1: authorized to connect
Usbguard is meant to block all devices hotplugged after system boot. To make persistent changes, you can add rules to /etc/usbguard/rules.conf
. You can generate config from current rules with usbguard generate-policy
.
So, to see what's changed between them, you can:
usbguard generate-policy | sudo diff - /etc/usbguard/rules.conf
And to overwrite the rules file with current run:
usbguard generate-policy | sudo tee /etc/usbguard/rules.conf
You can also edit the rules manually and copy across machines etc.