August 2008
« Jul   Oct »

Shell script to copy all files recursively and upload them to remote FTP server

#!/bin/bash FTP=”/usr/bin/ncftpput” CMD=”” AUTHFILE=”/root/.myupload” if [ -f $AUTHFILE ] ; then # use the file for auth CMD=”$FTP -m -R -f $AUTHFILE $myf $remotedir $localdir” else echo “*** To terminate at any point hit [ CTRL + C ] ***” read -p “Enter ftpserver name : ” myf read -p “Enter ftp username : ” [...]

How to increase the root partion using LVM without unmounting

Add new disk to existing server

a, Exicute

#fdisk -l

it shows the added disk at the end of the line and display no valid partions found on there. Now we need to partion the disk and create the primary partion type as Linux LVM (8e)

here my disk is mounted as /dev/sdb

#fdisk /dev/sdb [...]

How to redirect the page within your php application

PHP Redirect Script

You can easily redirect using following code:

<?php /* Redirect browser */ header(“Location:”); /* Make sure that code below does not get executed when we redirect. */ exit; ?> Another sample hack

Sample function – sitefunctions.php (note I’m not the author of the following I found it somewhere else on the [...]

How do I erase a hard drive?

dd is a handy tool used for making copys. It can also be used to quite securely wipe harddrives:

for (( i = 0;i<10;i++ )); do dd if=/dev/random of=dev/hda && dd if=dev/zero of=/dev/hda done

This will overwrite your entire hard drive (in this case seen as hda by Linux) with random information ten time


How to install java on Ubuntu

This small guide shows how to install the original Sun Java 2 Platform Standard Edition 5.0 JRE (Java Runtime Environment) and JDK (Java Developer Kit) on Ubuntu.

The original Sun Java 2 is available in the ‘multiverse’ section of the Ubuntu repositories. To enable this section first add the multiverse repository to the apt sources [...]

Secure Webserver from Php function vulernability

PHP has a lot of functions which can be used to crack your server if not used properly. You can set list of functions in php.ini using disable_functions directive. This directive allows you to disable certain functions for security reasons. It takes on a comma-delimited list of function names. disable_functions is not affected by Safe [...]