Php has obtained the ifconfigeth0down permission through sudo. I have already opened many posts, but I really can't achieve it. I hope you can give me some advice, even if it is materials. if phpsudo gets the permission, it's really unreliable on the oknet. ------ solution -------------------- I am like this: after sudogeditetcsudoers is modified, you do not need to enter the sudo password. php uses sudo to obtain the ifconfig eth0 down permission.
I have already opened many posts, but I really can't achieve it. I hope you can give me some advice, even if it's materials. If php sudo has the permission, it's really unreliable on the Internet.
------ Solution --------------------
I am like this: after sudo gedit/etc/sudoers is modified, the sudo password is not required.
Http://jingyan.baidu.com/article/495ba84135a16738b30eded1.html
------ Solution --------------------
The answer is
1. create a file, such as pw.txt, to save your root password. for example, the password is 1234.
Remember that only 1234 of the file content is needed
2. php file content
Shell_exec ('sudo-u root-S ifconfig eth0 down <./pw.txt ');
Disable Nic normally
------ Solution --------------------
As you have done, isn't the user protection of the operating system actually a false one?
Put the operations you need into the shell file and execute them in the waiting process or scheduled task.
Check whether there is a start signal first. if not, do not run it.
Generally, the startup signal can be used as a file and can be written by php in web mode.