Archive for May, 2009

SBDavid

Apache Handlers

Apache Handlers

Apache handlers allow you to control what Apache will do with certain file types. When Apache sees a file, it has an action built in for that file type, and will perform that action. If you wish Apache to do a different action, you will need to make a handler to tell Apache to perform that action. For example, if you use a file type that requires a special service to run it, such as a file with server side includes that is not named with a .shtml extension, you need to tell Apache to treat these files differently.

System Apache Handlers


Handler                                                     Extension(s)   

cgi-script                                                  .cgi .pl .plx .ppl .perl
server-parsed                                            .shtml
SBDavid

Extracting the MBR

Extracting the MBR

To see the contents of your MBR, use this command:

# dd if=/dev/hda of=mbr.bin bs=512 count=1
# od -xa mbr.bin

The dd command, which needs to be run from root, reads the first 512 bytes from /dev/hda (the first Integrated Drive Electronics, or IDE drive) and writes them to the mbr.bin file. The od command prints the binary file in hex and ASCII formats.

SBDavid

Disable ping request to the server

Disable ping request to the server

Diable ping using the following type:

echo 1 >/proc/sys/net/ipv4/icmp_echo_ignore_all

or

As superuser, add the following lines to /etc/sysctl.conf

net.ipv4.icmp_echo_ignore_broadcasts = 1
net.ipv4.icmp_echo_ignore_all = 1

Then run the following command to cause the change to take effect immediately:

sysctl -p

This change will persist following a reboot.

SBDavid

How to encrypt file with passphrase

How to encrypt file with passphrase

Mcrypt is a simple crypting program, a replacement for the old unix crypt(1). When encrypting or ecrypting a file, a new file is created with the extension .nc and mode 0600. The new file keeps the modification date of the original. The original file may be deleted by specifying the -u parameter. If no files are specified, the standard input is encrypted to the standard output.

$ mcrypt -uz file1

Enter the passphrase (maximum of 512 characters)
Please use a combination of upper and lower case letters and numbers.
Enter passphrase:
Enter passphrase:
File file1 was encrypted.

-d, –decrypt decrypts.
-z, –gzip Use gzip to compress files before encryption.
-u, –unlink Unlink the input file after encryption or decryption.

SBDavid

/proc/kcore

/proc/kcore

This file represents the physical memory of the system and is stored in the core file format. Unlike most /proc/ files, kcore displays a size. This value is given in bytes and is equal to the size of the physical memory (RAM) used plus 4 KB.

The contents of this file are designed to be examined by a debugger, such as gdb, and is not human readable.

$ ls -l /proc/kcore
-r——– 1 root root 267243520 May 26 06:14 /proc/kcore

« Prev - Next »