linux - php impersonate user -


I'm trying to do is shell commands from the system web page as root is run .

I've done the research, there is no way to impersonate a system user to PHP in terms of his (Santos 6.3 to be exact) with PHP 5.4.13.

So far I sudo is set and the line Apache ALL = (ALL): NOPASSWD for all (test) / Etc / sudoers to . I then created a simple php file in the root of your website:

    

and nothing happens, though, if I'm running:

  & lt; Php shell_exec ('whoami'); ? & Gt;   

I get the apache as a result, so I know that at least shell_exec is working.

If I cli Su apache , I found this account is not currently available. I believe because Apache has a Knowledge Defined (?) Apache: x: 48: 48: Apache: / var / Www: / sbin / nologin

So what commands have to be able to run from php as root?

By running the example of what I am trying to get as root, I want to add the certificate to the / etc / ssl / certificate / https the following command line one The Web Control Panel is called using:

  openssl request - new -nodes -x509 -days 3650 \ -subj "/ EmailAddress = $ {ssl_email} / CN = CA. $ { domain_name} / OU = $ {ssl_organisational_unit} / o = $ {ssl_organisation} / L = $ {ssl_location} / ST = $ {ssl_state} / C = $ {ssl_country} "\ -keyout" $ {certroot} / cacert. Pem "out" $ {certificateroot} /cacert.pem "  

up Mr. appreciate the help.

Ahh !!! found it!

After some time I wrote that, I found

Answer and default requiretty to comment out the / etc / sudoers

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -