1) View PHP running users:
<?php
System (' id-a ');
?>
General PHP running user is Apache
2) do a key trust for Apache users:
2.1)
First look at the Apache user information:
# Su-apache
This account was currently not available.
# Cat/etc/passwd|grep Apache
Apache:x:48:48:apache:/var/www:/sbin/nologin
Switch
Apache:x:48:48:apache:/var/www:/bin/bash
2.2)
Root User action:
Mkdir/var/www/.ssh
Chown Apache. /var/www/.ssh
2.3)
Then switch to Apache User:
Su-apache
SSH-KEYGEN-T RSA
2.4)
Root user, and finally change back to Nologin:
Apache:x:48:48:apache:/var/www:/sbin/nologin
3) Page wording:
3.1)
Cat/var/www/html/function/restart.html
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
<title> Restart Service </title>
<body>
<p>
<script language= "JavaScript" >
function Checkyes () {
if (!confirm ("Confirm to restart?") ")) {
Window.event.returnValue = false;
}
}
</script>
<form action= "restart.php" target= "_blank" method= "get" >
<input name= "" type= "submit" value= "Restart Service" onclick= "Checkyes ()"/></form>
</p>
</body>
3.2)
cat/var/www/html/function/restart.php
<?php
System ("ssh [email protected]/root/scripts/test.sh");
?>
3.3)
Apache Configuration Riga Password Verification:
<Directory/var/www/html/function/>
AuthType Basic
AuthName SYS
authuserfile/var/www/html/function/.htpasswd
Require user sys
</Directory>
HTPASSWD-BC/VAR/WWW/HTML/FUNCTION/.HTPASSWD SYS 123456
3.4)
Make a hyperlink embed another page
<a href= "http://x.x.x.x/function/restart.html" target= "_blank" > Restart </a>
Simple web-controlled shell scripting method