/dev/i2c-1
에서 장치를 읽는 프로그램이 있습니다. 이 소프트웨어는 pa_access
이라고하며 여기 예제 실행 : 당신이 볼 수 있듯이sudo "-u"옵션이 작동하지 않습니다.
[email protected]:~$ sudo ./pa_access
Input [0]: 0
Input [1]: 0
Input [2]: 0
Input [3]: 0
Input [4]: 0
Input [5]: 0
Input [6]: 0
Input [7]: 0
Input [8]: 0
Input [9]: 0
Input [10]: 0
Input [11]: 0
Input [12]: 0
Input [13]: 0
Input [14]: 0
Input [15]: 0
Input [16]: 0
Input [17]: 0
Input [18]: 0
Input [19]: 0
Input [20]: 0
Input [21]: 0
Input [22]: 0
Input [23]: 0
Input [24]: 0
Input [25]: 0
Input [26]: 1
Input [27]: 0
Input [28]: 0
Input [29]: 0
는,이 소프트웨어가 하드웨어 입력의 집합을 읽고 한 다음, 입력 상태를 출력합니다. 따라서 프로그램은 sudo
을 사용하여 실행해야합니다.
문제는 사용자가 예를 들어, "-u"옵션에 의해 지정 될 때 발생합니다
[email protected]:~$ sudo -u www-data ./pa_access
Error setting comunication with PA board on /dev/i2c-1.
Input [0]: 0
Input [1]: 224
Input [2]: 252
Input [3]: 182
Input [4]: 169
Input [5]: 138
Input [6]: 0
Input [7]: 0
Input [8]: 79
Input [9]: 146
Input [10]: 0
Input [11]: 0
Input [12]: 188
Input [13]: 187
Input [14]: 246
Input [15]: 182
Input [16]: 33
Input [17]: 146
Input [18]: 0
Input [19]: 0
Input [20]: 0
Input [21]: 0
Input [22]: 0
Input [23]: 0
Input [24]: 0
Input [25]: 160
Input [26]: 246
Input [27]: 182
Input [28]: 0
Input [29]: 0
가 (동일한 오류입니다 sudo
없이 실행하면 발생합니다.
[email protected]:~$ sudo -u ubuntu ./pa_access
Error setting comunication with PA board on /dev/i2c-1.
Input [0]: 0
Input [1]: 224
Input [2]: 252
...
...
Input [26]: 246
Input [27]: 182
Input [28]: 0
Input [29]: 0
그러나 -u
에 대한 매개 변수로 root
를 전달 잘 작동 : 로그인 한 사용자와하려고하면
같은 오류가 나타납니다.
PHP 스크립트에서 프로그램을 실행하고 싶으므로 사용자를 지정해야합니다.
무엇이 잘못 되었습니까? 어떤 아이디어? 미리 감사드립니다.