Archive for October, 2010

SBDavid

Check the most IP connect to server

Check the most IP connect to server

netstat -an | grep :80 | awk ‘{print $5}’ | sed -e s/’:.*’/”/g | sort | uniq -c

or

netstat -anp |grep ‘tcp\|udp’ | awk ‘{print $5}’ | cut -d: -f1 | sort | uniq -c | sort -n

or

netstat -ntu | awk ‘{print $5}’ | cut -d: -f1 | sort | uniq -c | sort -n

Block an IP from access to your server with IPtable

Use the command netstat -n command to see the IP addresses connected to your server. Once you have found the IP address you want to block you can use the following below command to block them from accessing your server using iptables.

-I INPUT 1 means to insert the rule at the top of the INPUT table (which means it will get looked at first)

-s IP-ADDRESSS is the source address of the packets we want to deal with

-j DROP means dump the packets into the void, and forget they ever happened.

iptables -I INPUT 1 -s IP-ADDRESSS -j DROP
SBDavid

Add user to sudoers list

Add user to sudoers list

sudoers - list of which users may execute what.

Login as root and then run the command visudo, add a line. Replace username to the actual user name.

username ALL=(ALL) ALL

/etc/sudoers - This file MUST be edited with the ‘visudo’ command as root.

To add all user in wheel group to sudoers list, login as root and then run the command visudo to uncomment the line below, or add this line is it not exist.

%wheel ALL=(ALL) ALL
SBDavid

Start of Authority (SOA) record

Start of Authority (SOA) record

The SOA record is the first record in a properly configured zone. It contains information about the zone in a string of fields. An SOA record tells the server to be authoritative for the zone. The SOA record takes the format.

Example:

domain.name. IN SOA hostname.domain.name. mailbox.domain.name
serial-number
refresh
retry
expire
minimum-ttl

domain.name - The name of the domain to which the SOA belongs. Instead of writing out the full domain, you can also use ‘@’ in the file to let the nameserver fill this out automatically.

IN - The class of the DNS record. ‘IN’ is an abbreviated form of ‘Internet’.
SOA - The type of DNS record, which in this case is ‘Start of Authority’.

hostname.domain.name - Also known as the ‘hostmaster’ field. It contains the e-mail address of the person responsible for maintaining the zone.

minimum-ttl - The default TTL (Time To Live) for every record in the zone. The default is only used when a particular resource record does not have its own specified TTL value. When changes are being made to a zone, the default is often set at ten minutes or less.

Cpanel disk space consumed by an account’s MySQL and PostgreSQL database

To enable this feature toggle the following Tweak Setting:

When displaying disk usage in cPanel/WHM include Postgresql and MySQL® disk usage.

As with the database counts, the disk usage calculation is handled by /scripts/update_db_cache which executes every 4 hours. This script is executed upon enabling the Tweak Setting. Administrators may also execute this script to recalculate the figures.

The disk usage figures are stored in /var/cpanel/datastore/mysql-disk-usage and /var/cpanel/datastore/postgres-disk-usage.

cat /var/cpanel/datastore/mysql-disk-usage

Support for /scripts/updatemysqlquota ends as of cPanelTM 11.25.0. Per this change /scripts/updatemysqlquota is no longer distributed with the product.

Reference: http://cpanel.net

Next »