为什么PyUSB/libusb在Linux上需要root(sudo)权限? [英] Why does PyUSB / libusb require root (sudo) permissions on Linux?

查看:526
本文介绍了为什么PyUSB/libusb在Linux上需要root(sudo)权限?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近,我一直在玩弄 PyUSB ,并发现它在Linux上运行良好(Ubuntu具有 libusb 0.1和1.0,以及 OpenUSB )...,但前提是我必须以root特权(当然,要使用sudo)运行该程序.

I have been toying around with PyUSB lately, and found that it works beautifully on Linux (Ubuntu has libusb 0.1 and 1.0, as well as OpenUSB)... but only if I run the program with root privileges (with sudo, of course).

谁能告诉我为什么它需要提升的特权,更重要的是,如果我可以以某种方式更改权限以使其对普通用户帐户起作用,那么

Can anyone tell me why it requires elevated privileges and, more importantly, if I can change the permissions somehow to make it work for normal user accounts?

推荐答案

libusb允许您以任意方式操作任意USB设备.例如,您可以格式化外部USB硬盘.

libusb allows you to manipulate arbitrary USB devices in arbitrary ways. You could format an external USB harddisk, for example.

通常,所有直接硬件访问都需要root特权,尽管我猜想实际上并不需要完全的root特权,但只需CAP_SYS_RAWIO就可以了.

In general, all direct hardware access requires root privileges, although I guess that actually full root privileges are not required, you should be fine with just CAP_SYS_RAWIO.

这篇关于为什么PyUSB/libusb在Linux上需要root(sudo)权限?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆