Archive for November 2011

Script to replace the hacked index page server wide

Many times it happens that the hacked index.htm  pages are uploaded by hackers under 
all account's hosted on the server and one has to either remove or rename those hacked
index.htm pages and it becomes very difficult to  rename all  hacked index.htm pages one
by one if there are many accounts hosted on  the affected server.  

So, if you come accross the same situation then don't panic just  use the below 
command to rename all  hacked index.htm pages to index.htm-hacked

[email protected][#]  for i in `find -mindepth 1 -maxdepth 3 -name index.htm`; do  mv $i $i-hacked ;  done

Note :: You can replace index.htm with whatever file name that is affected, for ex : index.php, index.html etc and make sure you are executing the above command in /home directory.

That’s all you are done,  easy isn’t it.

VirtualBox Commands

If you are new to  VirtaulBox then the below commands will  help you to gather information and control your VM’s :

How to show the VirtualBox VM info
[email protected][#] VBoxManage showvminfo <vmname>

for example

[email protected][#] VBoxManage showvminfo vm1
How to show the VM Harddrive info
[email protected][#] VBoxManage showhdinfo <filename>

for example

[email protected][#] VBoxManage showhdinfo vm1.vdi
How to list running VM
[email protected][#] VBoxManage list runningvms
How to list available VM
[email protected][#] VBoxManage list vms
How to list available VM Harddrives
[email protected][#] VBoxManage list hdds
How to list available ISO’s
[email protected][#] VBoxManage list dvds

How to Control VM

How to Start VM

 use nohup command and & to run process in background,
 so VM continues to run after exiting console.
[email protected][#] nohup VBoxHeadless --startvm <vmname> &

for example

[email protected][#] nohup VBoxHeadless --startvm vm1 &
How to pause VM
[email protected][#] VBoxManage controlvm <vmname> pause

for example

[email protected][#] VBoxManage controlvm vm1 pause

How to resume VM

[email protected][#] VBoxManage controlvm <vmname> resume

for example

[email protected][#] VBoxManage controlvm vm1 resume

How to reset VM

[email protected][#] VBoxManage controlvm <vmname> reset

for example

[email protected][#] VBoxManage controlvm vm1 reset

How to poweroff VM (hard poweroff eg. pull the plug)

[email protected][#] VBoxManage controlvm <vmname> poweroff

for example

[email protected][#] VBoxManage controlvm vm1

How to send poweroff single to VM (tells VM OS to shutdown)

[email protected][#] VBoxManage controlvm <vmname> acpipowerbutton

for example

[email protected][#] VBoxManage controlvm vm1 acpipowerbutton

How to attach a DVD / CD to a running vm

[email protected][#] VBoxManage controlvm <vmname> dvdattach <filename>

for example

[email protected][#] VBoxManage controlvm vm1 dvdattach CentOS-5.7-i386-bin-DVD-1of2.iso

How to de-attach a DVD / CD from a running vm

[email protected][#] VBoxManage controlvm <vmname> dvdattach none

for exampe

[email protected][#] VBoxManage controlvm vm1 dvdattach none

How to find out the VM IP

[email protected][#] VBoxManage guestproperty get <vmid>"/VirtualBox/GuestInfo/Net/0/V4/IP"

for example

[email protected][#] VBoxManage guestproperty get vm1  "/VirtualBox/GuestInfo/Net/0/V4/IP"

R1soft Kernel header error

While installing kernel package using the command 

/usr/bin/r1soft-setup --get-module

if you came across the  below errors :  

Unable to find a valid source directory.
Please install the kernel headers for 
your operating system.

Then don't panic  this can simply be resolved
 by running the below commands 
[email protected][#] yum install kernel-devel kernel-headers 

If you are running PAE kernel 

[email protected][#] yum install kernel-PAE-devel  

If you are running xen kernels 

[email protected][#]yum install kernel-xen-devel  
If you are running one of the beta kernels then,
 add --enablerepo=cloudlinux-updates-testing
 at the end of yum command, like this: 

yum install kernel-devel --enablerepo=cloudlinux-updates-testing 

Now, just re-execute the command : 
/usr/bin/r1soft-setup --get-module

That’s all.