Friday, May 18, 2007

Setting up mysql password

Setting up mysql password is one of the essential tasks. root user is MySQL admin account. Remember Linux/UNIX login root account for your operating system and MySQL root are different. They are separate and have nothing to do with each other (indeed some admin removes root account and setup admin as mysql super user).

Method # 1
If you have never set a root password for MySQL, the server does not require a password at all for connecting as root. To setup root password for first time, use mysqladmin command at shell prompt as follows:

$ mysqladmin -u root password NEWPASSWORD

However if you want to change (or update) a root password, then you need to use following command:

$ mysqladmin -u root -p oldpassword newpass

Enter password:

To change a normal user password you need to type (let us assume you would like to change password for vivek):

$ mysqladmin -u vivek -p oldpassword newpass

Method # 2:
MySQL stores username and passwords in user table inside MySQL database. You can directly update password using following method to update or change password for user vivek:

1) Login to mysql server, type following command at shell prompt:

$ mysql -u root -p

2) Use mysql database (type command at mysql> prompt):

mysql> use mysql;

3) Change password for user vivek:

mysql> update user set password=PASSWORD("NEWPASSWORD") where User='vivek';

4) Reload privileges (very important):

mysql> flush privileges;
mysql> quit

This method you need to use while using PHP or Perl scripting.

The MySql - Administration

How to retrieve the mysql root password.
/root/.my.cnf

above file contains the password

Setting the password:

1. From Unix:
shell> mysql -u username -h hostname -p password
mysql> SET PASSWORD FOR username@localhost=PASSWORD('new_password');

2. Directly manipulate the privilege tables:
shell> mysql -u username -h host -u username -p
mysql> UPDATE user SET Password=PASSWORD('new_password') WHERE user='root';
mysql> FLUSH PRIVILEGES;

3. Using the mysqladmin command:
shell> mysqladmin -u username password new_password

In our case we were able to change password specifying host name along with user name:
shell> bin/myslqadmin u username h localhost


MySQL Permissions & Grant Tables

In order to add a new user or update user's privileges in mysql grant tables login to mysql as a root user.

There are two options: use GRANT/REVOKE command or manipulating the MySQL grant tables directly.
The preferred method is to use GRANT statements - more concise and less error-prone.

If you modify the grant tables manually (using INSERT, UPDATE, etc.), you should execute
a FLUSH PRIVILEGES statement to tell the server to reload the grant tables.

To remove user: mysql> delete from user where user='username';
mysql> FLUSH PRIVILEGES;


Examples adding a new user with different level of privileges:
dummy: A user who can connect without a password, but only from the local host.

mysql> GRANT USAGE ON *.* TO dummy@localhost;

myUser : A full superuser who can connect to the server from anywhere,
but who must use a password 'pass' to do so.
GRANT statements should be for both myUser@localhost and myUser@"%".
to prevent the anonymous user entry for localhost take precedence.

mysql> GRANT ALL PRIVILEGES ON *.* TO myUser@localhost
IDENTIFIED BY 'pass' WITH GRANT OPTION;
mysql> GRANT ALL PRIVILEGES ON *.* TO myUser@"%"
IDENTIFIED BY 'some_pass' WITH GRANT OPTION;

"%" - is a wildcard in mysql. If you are defining your DB table and in the 'host' field
enter '%', that means that any host can access that database (Of course, that host
must also have a valid db user).


admin: A user who can connect from localhost without a password and who is granted
the RELOAD and PROCESS administrative privileges.
No database-related privileges are granted.

mysql> GRANT RELOAD,PROCESS ON *.* TO admin@localhost;


Add a user that has full rights to his database only but cannot see other database:
mysql> GRANT USAGE ON *.* TO 'user'@'host' GRANT Select, Insert, Update, Delete,
Create, Drop ON `database`.* TO 'user'@'host' FLUSH PRIVELEGS;

The FILE privelege and WITH GRANT OPTION may not be the best way to include, it is
only in case of creating another superuser with full set of privileges or
giving privileges to load data using mysql command INLOAD DATA.


GRANT TABLE FIELDS EXPLANATION:
TABLE USER: Everything after "password" is a privelege granted with values 'Y' or 'N'.
This table controls individual user global access rights.

'host','user','password','select','insert','update','delete','index','alter'
,'create','drop','grant','reload','shutdown','process','file'

TABLE DB: This controls access of USERS to databases.

'host','db','user','select','insert','update','delete','index','alter',
'create','drop','grant'

TABLE HOST: This controls which HOSTS are allowed what global access rights.

'host','db','select','insert','update','delete','index','alter',
'create','drop','grant'


HOST, USER, and DB table are very closely connected - if an authorized USER
attempts an SQL request from an unauthorized HOST, it is denied.
If a request from an authorized HOST is not an authorized USER, it is denied.
If a globally authorized USER does not have rights to a certain DB, it is denied.



Backups in MySQL

Full backup of MySql databases:
1. shell> mysqldump --tab=/path/to/some/dir --opt --full
OR
2. shell> mysqlhotcopy database /path/to/some/dir
OR
3. simply copy all table files (`*.frm', `*.MYD', and `*.MYI' files)

For a SQL level backup of a table use SELECT INTO OUTFILE or BACKUP TABLE.

mysql> BACKUP TABLE tbl_name[,tbl_name...] TO '/path/to/backup/directory'
Copies to the backup directory the minimum number of table files needed to
restore the table, after flushing any buffered changes to disk.

RESTORE TABLE tbl_name[,tbl_name...] FROM '/path/to/backup/directory'
Restores the table(s) from the backup that was made with BACKUP TABLE.
Existing tables will not be overwritten; if you try to restore over an existing
table, you will get an error. Restoring will take longer than backing up due to
the need to rebuild the index. The more keys you have, the longer it will take.
Just as BACKUP TABLE, RESTORE TABLE currently works only for MyISAM tables.

Selective backups can be done with:
SELECT * INTO OUTFILE 'file_name' FROM tbl_name
and restore with:
LOAD DATA INFILE 'file_name' REPLACE ...
To avoid duplicate records, you need a PRIMARY KEY or a UNIQUE key in the table.
The REPLACE keyword causes old records to be replaced with new ones when a new
record duplicates an old record on a unique key value.

Monitoring tools

The myisamchk utility is used to get information, check, repair or optimise mysql database tables:
shell> myisamchk [options] tbl_name

With no options, myisamchk simply checks the table.

Some useful Options for myisamchk utility:

1. Print informational statistics about the table that is checked: -i or --information
2. Check only tables that have changed since the last check: -C or --check-only-changed
3. The recommended way to quickly check all tables:
myisamchk --silent --fast /path/to/datadir/*/*.MYI

To Start the server automatically at system startup time

The mysql.server and safe_mysqld scripts can be used to start/stop the server automatically.
shell> mysql.server start
shell> mysql.server stop

See mysql.server in the `share/mysql' directory or in the `support-files' directory of the MySQL source tree.
The mysql.server script understands the following options: datadir, basedir, and pid-file.

If your system uses `/etc/rc.local' to start external scripts, you should append the following to it:

/bin/sh -c 'cd /usr/local/mysql ; ./bin/safe_mysqld --user=mysql &'

The mysql.server script understands the following options: datadir, basedir, and pid-file.


Backing Up MySQL Database

MySQL database backup can be accomplished in two ways:

a) Copying the raw mysql database files &
b) Exporting tables to text files

Copying the MySQL database files

MySQL uses the same table format on different platforms, so it's possible to copy MySQL table and index files from one platform and use them on another without any difficulties (assuming, of course, that you're using the same version of MySQL on both platforms).

Exporting tables to text files

The MySQLDump is handy utility that can be used to quickly backup the MySQL Database to the text files. To use the MySQLDump utility it is required to logon to the System running the MySQL Databse. You can use Telnet to remotely logon to the system if you don't have the physical access to the machine.

The syntax for the command is as follows.
mysqldump -u [Username] -p [password] [databasename] > [backupfile.sql]
[username] - this is your database username
[password]- this is the password for your database
[databasename] - the name of your database
[backupfile.sql] - the filename for your database backup



a) Taking the full backup of all the tables including the data.
Use the following command to accomplish this:
mysqldump -u admin -p admin accounts > accounts.sql

b) Taking the backup of table structures only.
Use the following command to accomplish this:
mysqldump -u admin -p admin --no-data accounts > accounts.sql

c) Taking the backup data only.
Use the following command to accomplish this:
mysqldump -u admin -p admin --no-create-info accounts > accounts.sql

Restoring MySQL Database

Restoring the MySQL is very easy job. You can use the following to command to restore the accounts database from accounts.sql backup file.

mysql - u admin -p admin accounts < accounts.sql

Sample File of my.cnf

Sample File Of /etc/my.cnf - genrally used in shared web hosting server:
----------------------------------------------------------------------------------------------------
[mysqld]
#datadir=/var/lib/mysql
#socket=/var/lib/mysql/mysql.sock
skip-locking
skip-innodb
query_cache_limit=1M
query_cache_size=32M
query_cache_type=1
max_connections=150
interactive_timeout=100
wait_timeout=100
connect_timeout=10
thread_cache_size=128
key_buffer=16M
join_buffer=1M
max_allowed_packet=16M
table_cache=1024
record_buffer=1M
sort_buffer_size=2M
read_buffer_size=2M
max_connect_errors=10
# Try number of CPU's*2 for thread_concurrency
thread_concurrency=2
myisam_sort_buffer_size=64M
log-bin
server-id=1

[mysql.server]
user=mysql
basedir=/var/lib

[safe_mysqld]
err-log=/var/log/mysqld.log
#pid-file=/var/lib/mysql/mysql.pid
open_files_limit=8192

[mysqldump]
quick
max_allowed_packet=16M

[mysql]
no-auto-rehash
#safe-updates

[isamchk]
key_buffer=64M
sort_buffer=64M
read_buffer=16M
write_buffer=16M

[myisamchk]
key_buffer=64M
sort_buffer=64M
read_buffer=16M
write_buffer=16M

[mysqlhotcopy]
interactive-timeout
----------------------------------------------------------------------------------------------------

System Admin - Level 2

System Admin - Level 2

How to find the Kernal version from sheel

# uname -r

How to find the apache version from sheel
[root@srv1 ~]# httpd -v
Server version: Apache/2.0.52
Server built: Nov 30 2004 11:22:20


How to search for certain terms in your Domlogs, using SSH.

for files in /usr/local/apache/domlogs/*; do grep "wget" $files; done;



-OR-

cd /usr/local/apache/domlogs
grep wget *
grep lynx *
grep curl *



Replace wget with other file names/terms you might want to search for.

If that takes too long, try doing it one by one:

grep wget a*
grep wget b*
grep wget c*
grep wget d*
grep wget e*
grep wget f*
grep wget g*
grep wget h*
grep wget i*
grep wget j*
grep wget k*
grep wget l*
grep wget m*
grep wget n*
grep wget o*
grep wget p*
grep wget q*
grep wget r*
grep wget s*
grep wget t*
grep wget v*
grep wget w*
grep wget x*
grep wget y*
grep wget z*



Alternatively, if you get an error like "Argument list too long":

for i in `ls /usr/local/apache/domlogs|grep -v 'bytes_log'`; do echo "checking on $i" && grep wget /usr/local/apache/domlogs/$i && grep lynx /usr/local/apache/domlogs/$i && grep curl /usr/local/apache/domlogs/$i; done > /root/grep-domlogs-results.txt


Then simply take a look at this file /root/grep-domlogs-results.txt
to ssh servers by nothingless on Jan 21, 2006
Looking up recent dictionary attacks
Use the code below to look up what words were used in recent dictionary attacks using SSH.

grep "dictionary attack" /var/log/exim_mainlog

to ssh servers by nothingless on Jan 21, 2006
Looking into DOS and DDOS Attacks
A good guide to what to do when your server is attacked.

top -d2
netstat -nap | grep SYN | wc -l
netstat -nap | less



If there are many httpd processes showing up after step 1, you might be under attack. If you get high numbers for the second one, you are almost definitely under attack. Use the third one to see the IP addresses, and then ban them from the server:

iptables -A INPUT -s ip.address -j DROP



Also try the following for fixing stuff:

cd /dev/shm
ls



And delete anything that's not supposed to be there.

locate bindz
locate botnet.txt
locate dc
locate ex0.pl
locate kaiten
locate r0nin
locate udp.pl
locate ...
lsof | grep .,
locate mybot

to ssh servers by nothingless on Jan 21, 2006
Ban IPs from a server
Use the code below to permanently ban an IP address from accessing your server.

iptables -A INPUT -s ip.address -j DROP

to ssh servers by nothingless on Jan 21, 2006
How to tail logs

tail -200 /var/log/exim_mainlog
tail -200 /usr/local/apache/logs/error_log



To watch the log get updated in real time:

tail -f /var/log/messages

to ssh servers by nothingless on Jan 21, 2006
How To Manually Update Cpanel

/scripts/upcp

/scripts/upcp --force

to ssh servers by nothingless on Jan 21, 2006
How To Restart Services
Restart Apache:

service httpd restart



Restart Services:

service chkservd restart



Restart Cpanel:

/etc/init.d/cpanel restart



Restart Bind:

service named start



Run anything in /scripts:

./scriptname

to ssh servers by nothingless on Jan 21, 2006
How To Locate Files

lsof | grep searchterm

to ssh servers by nothingless on Jan 21, 2006
How To Fix Bandwidth Updating
If bandwidth stats aren't updating:

/scripts/runweblogs username
/scripts/runlogsnow

to ssh servers by nothingless on Jan 21, 2006
How To Fix 403 Errors for public_html
If all the public_html folders got their permissions wrong:

chmod 755 /home/*/public_html

to ssh servers by nothingless on Jan 21, 2006
How To Empty /var
If /var is too full:

cd /var
du -sh *



If the log directory is the problem:

rm -f /var/log/*.1
rm -f /var/log/*.2
rm -f /var/log/*.3
rm -f /var/log/*.4



(The /var/log directory contains archived files that always end with a number: exim_mainlog.1. Any file ending with a number can be safely deleted.)

If the problem is with the exim_mainlog being too large, try rotating the logs:

/usr/sbin/logrotate -vf /etc/logrotate.conf



If you get an error about a duplicate log entry:

cd /etc/logrotate.d
rm -rf httpd.rpmorig.log



And try the rotate again.

If the problem is in spool:
System Admin - Level 2

How to find the Kernal version from sheel

# uname -r

How to find the apache version from sheel
[root@srv1 ~]# httpd -v
Server version: Apache/2.0.52
Server built: Nov 30 2004 11:22:20


How to search for certain terms in your Domlogs, using SSH.

for files in /usr/local/apache/domlogs/*; do grep "wget" $files; done;



-OR-

cd /usr/local/apache/domlogs
grep wget *
grep lynx *
grep curl *



Replace wget with other file names/terms you might want to search for.

If that takes too long, try doing it one by one:

grep wget a*
grep wget b*
grep wget c*
grep wget d*
grep wget e*
grep wget f*
grep wget g*
grep wget h*
grep wget i*
grep wget j*
grep wget k*
grep wget l*
grep wget m*
grep wget n*
grep wget o*
grep wget p*
grep wget q*
grep wget r*
grep wget s*
grep wget t*
grep wget v*
grep wget w*
grep wget x*
grep wget y*
grep wget z*



Alternatively, if you get an error like "Argument list too long":

for i in `ls /usr/local/apache/domlogs|grep -v 'bytes_log'`; do echo "checking on $i" && grep wget /usr/local/apache/domlogs/$i && grep lynx /usr/local/apache/domlogs/$i && grep curl /usr/local/apache/domlogs/$i; done > /root/grep-domlogs-results.txt


Then simply take a look at this file /root/grep-domlogs-results.txt
to ssh servers by nothingless on Jan 21, 2006
Looking up recent dictionary attacks
Use the code below to look up what words were used in recent dictionary attacks using SSH.

grep "dictionary attack" /var/log/exim_mainlog

to ssh servers by nothingless on Jan 21, 2006
Looking into DOS and DDOS Attacks
A good guide to what to do when your server is attacked.

top -d2
netstat -nap | grep SYN | wc -l
netstat -nap | less



If there are many httpd processes showing up after step 1, you might be under attack. If you get high numbers for the second one, you are almost definitely under attack. Use the third one to see the IP addresses, and then ban them from the server:

iptables -A INPUT -s ip.address -j DROP



Also try the following for fixing stuff:

cd /dev/shm
ls



And delete anything that's not supposed to be there.

locate bindz
locate botnet.txt
locate dc
locate ex0.pl
locate kaiten
locate r0nin
locate udp.pl
locate ...
lsof | grep .,
locate mybot

to ssh servers by nothingless on Jan 21, 2006
Ban IPs from a server
Use the code below to permanently ban an IP address from accessing your server.

iptables -A INPUT -s ip.address -j DROP

to ssh servers by nothingless on Jan 21, 2006
How to tail logs

tail -200 /var/log/exim_mainlog
tail -200 /usr/local/apache/logs/error_log



To watch the log get updated in real time:

tail -f /var/log/messages

to ssh servers by nothingless on Jan 21, 2006
How To Manually Update Cpanel

/scripts/upcp

/scripts/upcp --force

to ssh servers by nothingless on Jan 21, 2006
How To Restart Services
Restart Apache:

service httpd restart



Restart Services:

service chkservd restart



Restart Cpanel:

/etc/init.d/cpanel restart



Restart Bind:

service named start



Run anything in /scripts:

./scriptname

to ssh servers by nothingless on Jan 21, 2006
How To Locate Files

lsof | grep searchterm

to ssh servers by nothingless on Jan 21, 2006
How To Fix Bandwidth Updating
If bandwidth stats aren't updating:

/scripts/runweblogs username
/scripts/runlogsnow

to ssh servers by nothingless on Jan 21, 2006
How To Fix 403 Errors for public_html
If all the public_html folders got their permissions wrong:

chmod 755 /home/*/public_html

to ssh servers by nothingless on Jan 21, 2006
How To Empty /var
If /var is too full:

cd /var
du -sh *



If the log directory is the problem:

rm -f /var/log/*.1
rm -f /var/log/*.2
rm -f /var/log/*.3
rm -f /var/log/*.4



(The /var/log directory contains archived files that always end with a number: exim_mainlog.1. Any file ending with a number can be safely deleted.)

If the problem is with the exim_mainlog being too large, try rotating the logs:

/usr/sbin/logrotate -vf /etc/logrotate.conf



If you get an error about a duplicate log entry:

cd /etc/logrotate.d
rm -rf httpd.rpmorig.log



And try the rotate again.

If the problem is in spool:

cd /var/spool/exim/msglog
rm -rf *

to ssh servers by nothingless on Jan 21, 2006
How To Empty /usr
How To Empty /usr

cd /usr/local/apache/domlogs/
rm -rf *.*
/scripts/restartsrv httpd

to ssh servers by nothingless on Jan 21, 2006
How To Empty /backup
If /backup/ is too full:

cd /backup/cpbackup/monthly/
rm -f *.gz
/scripts/restartsrv httpd



Check the space after this, and it should be fine.
to ssh servers by nothingless on Jan 21, 2006
How To Fix Incorrect Disk Space
How To Fix Incorrect Disk Space

/scripts/fixquotas
/scripts/updatemysqlquota

to ssh servers by nothingless on Jan 21, 2006
How To Turn Off/On Stats For One Account
http://forums.cpanel.net/showthread.php?t=15967&highlight=urchin

You can edit the:

pico /var/cpane/users/accountname



file and add settings for the stats packages.

skipanalog=1
skipawstats=1
skipwebalizer=1



That will turn them off and override the server setttings.

To update the stats now:

/scripts/runweblogs username
/scripts/runlogsnow

to ssh servers by nothingless on Jan 21, 2006
How To Fix MySQL Error 28
MySQL: 1030: got error 28 from server handler

cd /tmp
df -i /tmp
df -h /tmp



Delete anything that’s not supposed to be there.
Stop all databases

/etc/rc.d/init.d/chkservd stop
/etc/rc.d/init.d/mysql stop



Then fix tables:

cd /var/lib/mysql



Check each letter for errors:

myisamchk -cs a*/*.MYI



Repair where necessary:

myisamchk -r a*/*.MYI
myisamchk -r b*/*.MYI
myisamchk -r c*/*.MYI
myisamchk -r d*/*.MYI
myisamchk -r e*/*.MYI
myisamchk -r f*/*.MYI
myisamchk -r g*/*.MYI
myisamchk -r h*/*.MYI
myisamchk -r i*/*.MYI
myisamchk -r j*/*.MYI
myisamchk -r k*/*.MYI
myisamchk -r l*/*.MYI
myisamchk -r m*/*.MYI
myisamchk -r n*/*.MYI
myisamchk -r o*/*.MYI
myisamchk -r p*/*.MYI
myisamchk -r q*/*.MYI
myisamchk -r r*/*.MYI
myisamchk -r s*/*.MYI
myisamchk -r t*/*.MYI
myisamchk -r u*/*.MYI
myisamchk -r v*/*.MYI
myisamchk -r w*/*.MYI
myisamchk -r x*/*.MYI
myisamchk -r y*/*.MYI
myisamchk -r z*/*.MYI



Turn everything back on:

/etc/rc.d/init.d/chkservd start
/etc/rc.d/init.d/mysql start


cd /var/spool/exim/msglog
rm -rf *

to ssh servers by nothingless on Jan 21, 2006
How To Empty /usr
How To Empty /usr

cd /usr/local/apache/domlogs/
rm -rf *.*
/scripts/restartsrv httpd

to ssh servers by nothingless on Jan 21, 2006
How To Empty /backup
If /backup/ is too full:

cd /backup/cpbackup/monthly/
rm -f *.gz
/scripts/restartsrv httpd



Check the space after this, and it should be fine.
to ssh servers by nothingless on Jan 21, 2006
How To Fix Incorrect Disk Space
How To Fix Incorrect Disk Space

/scripts/fixquotas
/scripts/updatemysqlquota

to ssh servers by nothingless on Jan 21, 2006
How To Turn Off/On Stats For One Account
http://forums.cpanel.net/showthread.php?t=15967&highlight=urchin

You can edit the:

pico /var/cpane/users/accountname



file and add settings for the stats packages.

skipanalog=1
skipawstats=1
skipwebalizer=1



That will turn them off and override the server setttings.

To update the stats now:

/scripts/runweblogs username
/scripts/runlogsnow

to ssh servers by nothingless on Jan 21, 2006
How To Fix MySQL Error 28
MySQL: 1030: got error 28 from server handler

cd /tmp
df -i /tmp
df -h /tmp



Delete anything that’s not supposed to be there.
Stop all databases

/etc/rc.d/init.d/chkservd stop
/etc/rc.d/init.d/mysql stop



Then fix tables:

cd /var/lib/mysql



Check each letter for errors:

myisamchk -cs a*/*.MYI



Repair where necessary:

myisamchk -r a*/*.MYI
myisamchk -r b*/*.MYI
myisamchk -r c*/*.MYI
myisamchk -r d*/*.MYI
myisamchk -r e*/*.MYI
myisamchk -r f*/*.MYI
myisamchk -r g*/*.MYI
myisamchk -r h*/*.MYI
myisamchk -r i*/*.MYI
myisamchk -r j*/*.MYI
myisamchk -r k*/*.MYI
myisamchk -r l*/*.MYI
myisamchk -r m*/*.MYI
myisamchk -r n*/*.MYI
myisamchk -r o*/*.MYI
myisamchk -r p*/*.MYI
myisamchk -r q*/*.MYI
myisamchk -r r*/*.MYI
myisamchk -r s*/*.MYI
myisamchk -r t*/*.MYI
myisamchk -r u*/*.MYI
myisamchk -r v*/*.MYI
myisamchk -r w*/*.MYI
myisamchk -r x*/*.MYI
myisamchk -r y*/*.MYI
myisamchk -r z*/*.MYI



Turn everything back on:

/etc/rc.d/init.d/chkservd start
/etc/rc.d/init.d/mysql start

Cpanel Scripts Usage:

Cpanel Scripts Usage:

Updates the server software:
/scripts/upcp

Reinstalls exim:
/scripts/exim4

View traffic or if you think a site is being DDoS:
cd /usr/local/apache/domlogs
tail -f targetsite.com

Bandwidth issues
/scripts/cleanbw

To fix problem in webalizer that stop updating stats
/scripts/fixwebalizer

Self Explanatory
/scripts/fixcommonproblems
/scripts/fixeverything

Fixing Mail List MailMan
/usr/local/cpanel/bin/convertmailman2

Reinstall MailMan
/scripts/reinstallmailman

/scripts/fixhome

MYSQL Conf:
pico /etc/my.cnf

Edit php.ini
pico /usr/local/lib/php.ini


Edit Apache Conf
pico /etc/httpd/conf/httpd.conf

Checking Real Time Top Processes Login to SSH and run
top

Run cpanel backup
/scripts/cpbackup

To try and fix domain controller
/scripts/fixndc

Quotas
/scripts/initquotas - takes a while to run
/scripts/resetquotas
/scripts/fixquotas - takes a while to run

Add a Dns Entry
/scripts/adddns

Install Frontpage Mail Exts
/scripts/addfpmail

Add JavaServlets to an account (jsp plugin required)

/scripts/addservlets

Add a User
/scripts/adduser

Run WHM Lite
/scripts/admin

Add Rlimits (cpu and mem limits) to apache
/scripts/apachelimits

Resync with a master DNS Server
/scripts/dnstransfer

Edit A User's Quota
/scripts/editquota

Search For Trojans in /dev
/scripts/finddev

Locate Trojan Horses
/scripts/findtrojans

Suggest Usage
/scripts/findtrojans > /var/log/trojans
/scripts/fixtrojans /var/log/trojans

Make Interchange work with suexec
/scripts/fixcartwithsuexec

Fix Most Problems with Interchange
/scripts/fixinterchange

Run on a trojans horse file created by findtrojans to remove them
/scripts/fixtrojans

Run this if a user's stats stop working
/scripts/fixwebalizer

Fix a broken valias file
/scripts/fixvaliases

Turn on DMA and 32bit IDE hard drive access (once per boot)
/scripts/hdparamify

Re-scan quotas. Usually fixes Disk space display problems
/scripts/initquotas

Turn on SUEXEC (probably a bad idea)
/scripts/initsuexec

Display Ipusage Report
/scripts/ipusage

Terminate an Account
/scripts/killacct

Delete "Security Problem Infested RPMS"
/scripts/killbadrpms

Fix Various Mail Permission Problems
/scripts/mailperm

Attempt to Troubleshoot a Mail Problem
/scripts/mailtroubleshoot

Change a Mysql Password
/scripts/mysqlpasswd

Kill Potential Security Problem Services
/scripts/quicksecure

Rebuild Ip Address Pool
/scripts/rebuildippool

Delete Nasty SSL entry in apache default httpd.conf
/scripts/remdefssl

Restart a Service (valid services: httpd,proftpd,exim,sshd,cppop,bind,mysql)
/scripts/restartsrv?? (example: /scripts/restartsrv httpd)

Syncup Security Updates from RedHat/Mandrake
/scripts/rpmup

Force a webalizer/analog update
/scripts/runlogsnow

Remove non-important suid binaries
/scripts/secureit

Install Frontpage 4+ on an account
/scripts/setupfp4

Return a Simple process list. Useful for finding where cgi scripts are running from
/scripts/simpleps

Suspend an account
/scripts/suspendacct

Syncup Cpanel RPM Updates
/scripts/sysup

Unblock an IP
/scripts/unblockip

UnSuspend an account
/scripts/unsuspendacct

Update Cpanel
/scripts/upcp

Update /scripts
/scripts/updatenow

Create a New Account
/scripts/wwwacct

Awstats to run manually
/scripts/runweblogs account_username

License Not working
rdate -s rdate.darkorb.net

Sometimes such behavior of apache/httpd (taking more and more memory until it dies or crashes the server) can be caused by corrupted MySQL database. Try to do the following:
1) Kill the mysql server
/etc/rc.d/init.d/mysql stop

2) Repair all SQL databases:
myisamchk -r /var/lib/mysql/*/*.MYI

3) Start mysql again:
/etc/rc.d/init.d/mysql start

-------------------------------------------------------------------------------

Restarting cpanel
/etc/rc.d/init.d/cpanel restart

To run your clients stats now
/scripts/runlogsnow

Restart the background proccess that runs the stats for your clients
/usr/local/cpanel/startup

To run your clients stats now
/scripts/runstatsonce

To run one clients stats:
/scripts/runweblogsnow username

Shut down http
httpd stop

Start http with SSL
httpd startssl

Start http
httpd start

/scripts/runweblogs