简体   繁体   English

不使用sudo无法执行程序

[英]cannot execute program without using sudo

I am having trouble getting a file to execute without typing sudo before it. 我无法在不输入sudo情况下执行文件,这很麻烦。 I think the problem is the libraries I used require you to be a superuser. 我认为问题是我使用的库要求您成为超级用户。

I am working on a program for the Raspberry Pi and so far everything has worked great. 我正在为Raspberry Pi编写程序,到目前为止,一切都很好。 The program takes a command line argument and outputs it to a separate 2x16 LCD. 该程序采用命令行参数并将其输出到单独的2x16 LCD。 So if I type the following command as root or place sudo in front of it the program functions as intended: ./serialTest Hello World . 因此,如果我以root用户身份键入以下命令或在其前面放置sudo ,则程序将按预期运行: ./serialTest Hello World

What I am working on now is getting the value of a text box on a PHP webpage and submitting it to the program as a command line argument using the exec() function in PHP The problem is that I am unable to execute it because unless I am root I have tried exec("sudo ./serialTest" . $textBox); 什么我现在的工作就是寻找一个文本框的值PHP网页,并使用其提交给程序的命令行参数exec()函数PHP的问题是,我无法执行,因为除非我是root我尝试过exec("sudo ./serialTest" . $textBox); but it still tells me Permission Denied 但是它仍然告诉我Permission Denied

After further reading into the libraries I am using I cam across instructions on how to execute the serialOpen function without using sudo or being root I have added the user pi and www-data to the dialout group I have verified this with id pi id www-data . 在进一步阅读库之后,我正在使用关于如何在不使用sudo或未成为root情况下执行serialOpen函数的说明,我将用户piwww-data到了dialout组中,我已使用id pi id www-data对此进行了验证id www-data The program still says Permission denied . 该程序仍显示“ Permission denied Is there something I could look at further or am I doing something wrong? 有什么我可以进一步看的还是做错了什么? I have included the excerpt from the page that states how to run it without using sudo or being root 我已经摘录了该页面的摘录,其中指出了如何在不使用sudo或成为root情况下运行它

You can use it without sudo if you add yourself into the dialout group. either edit /etc/group, or use the usermod command. (and logout/login again)
-Gordon

It depends on the server rights provided by Server Service Provider. 这取决于服务器服务提供商提供的服务器权限。 If you are the Service Prover then edit the Shell Access Rights to executed Exec command in PHP configuration file. 如果您是Service Prover,请在PHP配置文件中编辑Shell Access Rights以执行Exec命令。 As default, exec is not provided in default that's why the message is coming 默认情况下,默认情况下不提供exec,这就是消息即将到来的原因

If you are not service provider then contact them to do things.. 如果您不是服务提供商,请与他们联系以做事。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM