简体   繁体   English

对 GPIO 的 WiringPi 非 root 访问

[英]wiringPi non-root access to GPIO

From this I though acess to GPIO for non-root users would be possible using wiringPiSetupSys() but I failed trying that.这里我虽然可以使用wiringPiSetupSys()为非 root 用户访问 GPIO,但我尝试失败。

Actually, if I do setuid on the executable then it works.实际上,如果我在可执行文件上执行 setuid ,那么它就可以工作。 So, wiringPiSetupSys() isn't enought?那么, wiringPiSetupSys()还不够吗?

$ ./gpio write 4 1  // This don't work :(
# chown root gpioapp
# chmod u+x gpioapp
$ ./gpio write 4 1  // This works :)

According to the GPIO utility documentation , the gpio utility is designed to be installed as setuid.根据GPIO 实用程序文档gpio实用程序设计为作为 setuid 安装。 Once that has been used to export the pins (as is required by wiringPiSetupSys ), you can call wiringPiSetupSys as a non-root user (see http://wiringpi.com/reference/setup/ ).一旦它被用于导出引脚(根据wiringPiSetupSys要求),您可以以非root 用户身份调用wiringPiSetupSys (请参阅http://wiringpi.com/reference/setup/ )。

Is your non-root user a member of the gpio group?您的非 root 用户是 gpio 组的成员吗? – Ben Voigt — 本·沃格特

Yeah, that's the point!是的,这就是重点! It wasn't, just changed ( usermod -a -G gpio myuser ) and now it's working.不是,只是改变了( usermod -a -G gpio myuser ),现在它可以工作了。 – KcFnMi – KcFnMi

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 以非 root 用户身份访问 beaglebone 上的 GPIO? - Access GPIO on beaglebone as non root user? 授予非 root 用户对挂载存储桶的读取访问权限 - grant read access to non-root user to a mounted bucket 在 kubernetes 中授予非 root 用户 kubectl 的访问权限 - Granting a non-root user the access of kubectl in kubernetes 以root用户或非root用户身份运行Redis或Memcached吗? - Run Redis or Memcached as root or non-root? Docker Nginx工作进程以非root用户身份运行,但仍可以访问root拥有的文件 - Docker Nginx worker process runs as non-root user but still can access a file owned by root Linux / Python如何将root访问py模块作为非r​​oot用户导入? - Linux/Python How do I import a root access py module as a non-root user? 如何为非 root 用户配置 Dockerfile 但授予他们访问权限以写入根目录中的文件? - How to configure Dockerfile for non-root user but give them access privileges to write to a file in the root dir? 允许非root用户ioctl访问linux模块中的/ dev / mytest文件 - Allow non-root users ioctl access to /dev/mytest file in linux module 无法从非root用户访问/ dev / sda3 - can't access /dev/sda3 from non-root user 使用非root用户访问Mercurial时出错 - Error accessing mercurial with non-root user
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM