hi there,
this post is for php, perl or C programers, that they can create new script and add command link in WHM menu and work as root.
i'll give you an example now, i don't like to talk alot with security matters, there is no security problems because your scripts will work as root and you can't work with it until you log into WHM http://yourserver:2086/ or the ssl link.
let's begin:
first step use SSH to login as root
type this commands
# cd /usr/local/cpanel/whostmgr/docroot/cgi
# mkdir example
# chmod 0755 example
i'll use pico text editor
we will create a file under /usr/local/cpanel/whostmgr/docroot/cgi
called addon_example.cgi
this file will called from WHM menu and will redirect to our example directory
# pico addon_example.cgi
pico will open
copy and paste this code in it
and click <Ctrl+O> and <Ctrl+X>
now do this commands
# chmod 0755 addon_example.cgi
# cd example
# pico example.php
now type any php code inside or just text
use this for example
now save the file and exit click <Ctrl+O> and <Ctrl+X>
go to your site whm panel
http//yourserver:2086 or https://yourserver:2087
after login as root to whm scroll the left menu to the last one
yes it's the script Example
click it
i hope this start will make programmers do amazing addons for whm
regards
this post is for php, perl or C programers, that they can create new script and add command link in WHM menu and work as root.
i'll give you an example now, i don't like to talk alot with security matters, there is no security problems because your scripts will work as root and you can't work with it until you log into WHM http://yourserver:2086/ or the ssl link.
let's begin:
first step use SSH to login as root
type this commands
# cd /usr/local/cpanel/whostmgr/docroot/cgi
# mkdir example
# chmod 0755 example
i'll use pico text editor
we will create a file under /usr/local/cpanel/whostmgr/docroot/cgi
called addon_example.cgi
this file will called from WHM menu and will redirect to our example directory
# pico addon_example.cgi
pico will open
copy and paste this code in it
Code:
#!/usr/local/bin/perl
#WHMADDON:example:Example WHM Admin
print "Content-Type: text/html\n\n";
print '<meta http-equiv="refresh" content="0;url=/cgi/example/example.php"/>' ;
now do this commands
# chmod 0755 addon_example.cgi
# cd example
# pico example.php
now type any php code inside or just text
use this for example
Code:
My Script Is Working
go to your site whm panel
http//yourserver:2086 or https://yourserver:2087
after login as root to whm scroll the left menu to the last one
yes it's the script Example
click it
i hope this start will make programmers do amazing addons for whm
regards
Last edited: