im trying to write a script interfacing to WHM again via remote access key. What I want to achieve is to remove an ip from iptables. using PHP script (CURL), any thoughts on how i can remove an ip from iptables? I know the ssh command how to do it but i dont know if it will work via a PHP (CURL) script connecting to WHM via remote access key.
So I need to execute a list of commands via a cron job rather than having the script 'wait' for the shell to finish processing (as this was leading to time outs and all sorts of issues).
I'm guessing the way to do this is to have my php set up a cron job to occur at some point in the near future (like current time + 1 min), then to prevent the job from repeating the next hour, it removes itself from the cron list as the final command.
Does this sound like a reasonable way to go about executing a queue of shell commands from the browser that take an indefinite (possibly long) amount of time?
I've been concerned about executing commands through (./) using php and perl shells on the server
a new way of hacking these days is using perl shells , even if the perl was terminated on the server ,, or was forbidden for users hackers upload a (perl) program to the server to use it instead of the server's own perl
any way ,,
chmoding the (ls-cat-more-less) to 4750 seems to give permission denied when exeuting these programs on the server but the hackers also found that they could upload their own ls-cat-more-less programs and use them instead of the server's
they also could rename them ls==>ki or anything and use them like this
./ki /etc/valiases -alXrt and the commands work like charm for them
./ <<--- this command uses the sh program on the server ,, ((sh which refers to bash on most servers)) so
./ki is the same as
sh ki
and
bash ki
so i tried chmoding sh with 4750 and that killed the exploit
i was concerned about cpanel's and the website's functionality so i tried changing an accounts password and creating a database ,, they both worked fine
so ,, if u thing chmoding 4750 sh is a bad idea please let me know
and if you know any other ways of disabling all the perl scripts on the server
Code: [root@ns1 conf.d]# cat /etc/httpd/conf.d/php.conf # # PHP is an HTML-embedded scripting language which attempts to make it # easy for developers to write dynamically generated webpages. #
LoadModule php5_module modules/libphp5.so
SetOutputFilter PHP SetInputFilter PHP
AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps This prevents file.php.gif from executing in a non-chrooted site, but in my chrooted sites, file.php.gif will execute as a PHP file. Any idea why? Some other config I have to change?
how I can execute memtest86 remotely without any KVM access. Is this possible? If so, how would I go about it? I run Debian 5.0 32bit with bigmem kernel (16x4GB Dimms)
i have a vps account and am trying to setup my website i installed php 4 from a control panel where it auto installed php and there is mysql and i installed all of them but when i upload my script and go to install or go to the index of my site it shows the php code and does not execute.
my permissions are right on i also made a testphp file and used this code <?php phpinfo(); ?> and still nothing just shows the php code when you browse to the file i even went further i installed from the control panel another program called phpmyadmin and when i log in it does the same thing just shows php code so what the hell is going on you think i need to contact my host provider for this issue i sent an email out but waiting for a responce
A very simple shell script that rotates log files of lighttpd server everyday becomes zombie after executing via cron. If executed directly in the shell it just dies normally. Tried to add "exit 0;" in the last line but the same effect...
An important notice: the script stops and starts the server, maybe it dies abnormally because it forks a process (lighttpd)?
I have a new dedicated server and am trying to set up a cron job via CPanel on on of my accounts (we'll call it "abc" account).
In the Cron job area, where it asks for the command to run, I enter this:
/home/abc/public_html/forum/class/sendnotice.php
But when the job runs, it doesn't seem to be executing the .php file. Instead, I get stuff like this via email:
/home/acb/public_html/forum/class/sendnotice.php: line 1: ?php: No such file or directory /home/abc/public_html/forum/class/sendnotice.php: line 2: ////////////////////////////: is a directory /home/abc/public_html/forum/class/sendnotice.php: line 3: //: is a directory /home/abc/public_html/forum/class/sendnotice.php: line 4: //: is a directory /home/abc/public_html/forum/class/sendnotice.php: line 5: //: is a directory /home/abc/public_html/forum/class/sendnotice.php: line 6: //: is a directory /home/abc/public_html/forum/class/sendnotice.php: line 7: //: is a directory /home/abc/public_html/forum/class/sendnotice.php: line 8: //: is a directory /home/abc/public_html/forum/class/sendnotice.php: line 9: //: is a directory
So it is as if the cron job is reading each line of the .php file instead of just running it. Am I doing something wrong in setting up the cron job to run that file or could it be a configuration issue with the new server?
how I might be able to execute a Linux command by sending a text message to some email address? Where if that email address gets a message (either any message, or perhaps only messages containing some password), a Linux command is executed, e.g.
let TOTL=$GUAR/256 let KMMB=$KMEM/1048576 let PVMB=$PRIV/256 let USED=$KMMB+$PVMB let FREE=$TOTL-$USED if [ "$FREE" -gt "0" ]; then let UPER=$USED*100/$TOTL let FPER=100-$UPER else let UPER="100" let FPER="0" fi echo "VPS Memory:" echo " Total: $TOTL mb Used: $USED mb (${UPER}%) Free: $FREE mb (${FPER}%)" It gives Total: 512 mb Used: 482 mb (94%) Free: 30 mb (6%)
Why such huge difference??
Also "top" command shows top - 02:44:04 up 1 day, 9:55, 2 users, load average: 1.35, 1.04, 0.94
Is that good for a a VPS with 512 RAM? (The site has extremely high traffic)
I've been reading through tutorials for setting up cron commands via cPanel, but everything I have tried does not work. What I need to do is simple - I just want to run a php file on my server once every 15 minutes.
commands for cron job, i need to backup only 2 account backup in cron job one username is panther that a/c is in paretition "home" another a/c name logictec itz in partion "home2" for this two a/c only i need make cron job but there are in seprate partion can u help me in give the comman which can make backup in cronjob every one day
It may be useful to someone, sometimes the queded mail list gets gigantic because of some spammer and other emails that aren't spam could get deleted when using cPanel to control it.
The better solution would obviously be to prevent spammers of sending all those mails, if you know a better solution on cPanel 11 please share it with me.
if after doing the following and transferring my domains to the server, they will functions properly as far as BIND setup is concerned. This will also serve as installation instructions for others if you can verify that this is all good.
I have installed BIND9 and setup DNS with the following: ------------------------------------------------------------------------
zone "server.mydomain.com" { type master; file "server.mydomain.com.db"; }; zone "mydomain.com" { type master; file "mydomain.com.db"; }; zone "mydomain.net" { type master; file "mydomain.net.db"; }; Upload named.conf to /var/named/chroot/etc
Modify /etc/resolv.conf to have the following before its current data: search mydomain.com nameserver 127.0.0.1 nameserver 78.129.143.155 // Replace this with the server's IP // So below these there should be one or more nameserver $ip that point to the ISP's name servers so that the server can download stuff.
Modify /etc/host.conf to become the following: order hosts,bind multi on nospoof on
Modify the files mydomain.com.db and mydomain.net.db and server.mydomain.com.db to have the correct IP address. (These are DNS zone files that I'm sure are correct so I don't need you to confirm those.) * Upload them to /var/named/chroot/var/named
I'm trying to write some scripts that automate the installation of a website with a content management system. This includes creating domains, installing databases etc via plesk API.
Now we have it creating the domains and databases via plesk, this is not the issue. It's permission problems issuing commands on the server.
I need to have the script install the cms and this requires writing files to a folder on the server owned by a user which is created with the domain.
e.g. user creates timsdomain.com with ftp user name tim Plesk makes directory on webserver called ~/vhosts/timsdomain.com/ inside this directory is a folder called httpdocs. All the files within this folder are owned by tim.
Now my script (running as 'apache' in a folder owned by 'admin') needs to write/edit files to this directory as the user tim (or whatever user was created when the domain was set up).
How can I do this from a php script?
My idea would be to log in as the new user and then start issuing commands but I don't know how to login a user from a script.
I've tried exec, exec_shell etc trying to log in via script as the new user using sudo/su/suid etc but they all ask for a password (for obvious reasons) but I cannot see a way to send the password to the command with the script. Ssh? I don't know. Help
Here's some pseudocode that demonstrates what I'm trying to do, if you can think of a better way I'm all ears.
Code:
//User Fills in CMS/Domain information which becomes Form_Data
//HERE IS WHERE I AM HAVING TROUBLE: I can't figure out how to change the user so I can install files to a // different directory other than the current user's directory (admin)
Build_CMS(Form_Data) {
change_to_user(Form_Data.ftp_username, FormData.ftp_password); unpack_CMS_archive_into(user_directory); //eg unpack cms.tar into 'timsdomain.com' (if the above command didn't switch the current directory to users home directory)
//initialises CMS config files and installs CMS data to database Run_Install_Scripts_On_Server(Form_Data); //albeit complex, most important part of script Confirm_Tim_Is_Awesome(); }
Confirm_Tim_Is_Awesome() { while (getTim().has_moustache()) { echo "<em>You're still awesome. </em>"; } }
I've been trying to set up a "console host" in addition to my main "site front" so that I can easily manage MySQL without needing the use of the Workbench (i.e. phpmyadmin). But even when I add the "mod_authz_host" module file to my configuration and correctly referencing it with LoadModule, it says:
Quote: Invalid command 'Order', perhaps misspelled or defined by a module not included in the server configuration This is what is in my configuration file as of now:
I am just trying out MySQL on the external Apache server. I must have written down the wrong password. My commands to enter mysql with a password results in denied access.
What file do I undo in order to create a new password? I don't know the exact steps I'm supposed to take. I don't think this is a MySQL issue, but a server issue, right?
I used to create databases and tables on my regular computer and left off the password altogether while I was practicing. Now I'm taking steps to do it on the actual server, and have run across this problem.
Question 1 I had a script create a backup of every file on my site using the following format "filename.php.bac". I want to delete these files now and I tired to use "rm *.bac" but that only deleted the files in the current directory. How can I delete ALL those files in EVERY directory and sub-directory starting at the public_html directory?
Question 2 How can I escape semi-colon's (;) in a perl script? I'm trying to run a search+replace script to update some Analytics code and I have a ton of files to update but for some reason if there is a semi-colon in the find varable, it assumes that it has reached the end of the contents in that variable.
Here is the code. Take a look at the $find variable and you will see extra semi-colon's. How do I tell the script to not treat those semi-colons as the end of the variable? .........
Is it possible to schedule consecutive shell commands to be run at a given time or every certain period (like every hour)?
This is important for me as I want to schedule to run certain program and then input the following commands afterwards to do and complete the task, all automatically within the specified schedule.
One example would be connecting to an FTP. First you'd need to input the ftp command to run the ftp program, then following that, input another commands consecutively within that session (the ftp program) to do and complete the task.
After update of some system commands, there is now difference between the system-wide command and the equivalent that is located in the chroot template directory (and the command that is in the domain's bin dir).
Is there a command/utility that can update the commands (and all libraries that they depend on), that we have in our chroot template directory /var/www/vhosts/chroot?