PHP get ifconfig eth0 down permission solution via sudo

Source: Internet
Author: User
PHP gets ifconfig eth0 down permissions via sudo
I have already opened a lot of posts, I really can not achieve the hope that the great God to guide anything, even if it is the information of PHP sudo access to the right online is really not reliable AH

------Solution--------------------
I am: sudo gedit/etc/sudoers modified without sudo to lose the password
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, a password of 1234
Remember, the contents of the file are only 1234

2.php File Contents
Shell_exec (' sudo-u root-s ifconfig eth0 down <./pw.txt ');

Test Shutdown network card gracefully
------Solution--------------------
As you pointers, the user protection of the operating system is not a fake?

Put the action you need into the shell file, either in the waiting process or in a scheduled task
Only forward first check if there is a start signal, if not do not execute
Start signal can be a file, can be written in PHP web-style
  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.