PHP interacts with Linux and obtains the root permission

Source: Internet
Author: User

We all know that the default user of Apache is nobody.

Some External commands, nobody, can hardly do anything.

If you want to get the permission

1: Modify httpd. conf and set

User nobody

Group nobody

Change

User xxx

Group xxx

The xxx here cannot be root. Once it is root, congratulations, your Apache will no longer start! Only other users

Permission is a common user level

2: Use the su command to interact with Linux

The statement is as follows:

$ Su = 'Su-c "init 0 "';
$ Password = "root"; // Root Password
$ Fp = @ popen ($ Su, "W ");
@ Fputs ($ FP, $ password );
Pclose ($ FP );

After the execution, if your computer is shut down, it will succeed.

I tried it on my computer. It was successful.

Fedora 15 indicates no pressure

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.