This is default featured slide 1 title
This is default featured slide 2 title
This is default featured slide 3 title
This is default featured slide 4 title
This is default featured slide 5 title
 

Simple Bash Script to Fix Account Permissions

This is a simple bash script I wrote to fix the permissions and ownership of files within a cpanel account. To use, simply copy the script your server, chmod 755, and pass the usernames as arguments:

./fixperms user1 user2 user3

You can also run a server-wide loop like this:

for i in `ls -A /var/cpanel/users` ; do ./fixperms $i ; done

Secure Your SSH Access

To restrict and secure SSH access, bind sshd to a single IP that is different than the main IP to the server, and on a different port than port 22.

SSH into server and login as root.

At command prompt type: pico /etc/ssh/sshd_config

Scroll down to the section of the file that looks like this:

#Port 22
#Protocol 2, 1
#ListenAddress 0.0.0.0
#ListenAddress ::

Uncomment and change

How to Secure and Optimize a Server or VPS – 2

Tutorials following continued discussions from How to Secure and Optimize a Server or VPS part 1

=========================================
Install BFD (Brute Force Detection – optional)
=========================================

To install BFD, SSH into server and login as root.

At command prompt type:

cd /root/
wget http://www.rfxnetworks.com/downloads/bfd-current.tar.gz
tar -xvzf bfd-current.tar.gz
cd bfd-0.4
./install.sh

How to Secure and Optimize a Server or VPS – 1

When you have a Dedicated Server or Virtual Private Server (VPS) security issues and optimization of a server is a necessity that must be considered by a sysadmin. Here I have to say a few ways that can be used to secure and optimize a Dedicate server or Virtual Private Server (VPS).

=========================================
Checking for formmail
=========================================

Form mail is used by hackers to send out spam email, by relay and injection methods.

Command to find pesky form mails:

find / -name "[Ff]orm[mM]ai*"

CGIemail is also a security risk:

find / -name "[Cc]giemai*"

Command to disable form mails:

chmod a-rwx /path/to/filename

(a-rwx translates to all types, no read, write or execute permissions).

(this disables all form mail)

If a client or someone on your vps installs form mail, you will have to let them know you are disabling their script and give them an alternative.

[ How to fix ] Mod Security Showing blank page & database password change

Please check that the password in /etc/cron.hourly/modsecparse.pl matches the MySQL password of the modsec user:

grep dbpassword /etc/cron.hourly/modsecparse.pl

This will show the current password for the modsec user, then check it matches the existing one in the MySQL database:

mysql
\u mysql
select password from user where user='modsec';
select password('dbpasswordhere');

Replace dbpasswordhere with the password found when grepping the modsecparse.pl file. If the passwords do not match, reset the password:

mysql
\u mysql
UPDATE user SET Password=PASSWORD('dbpasswordhere') WHERE User='modsec';

Again, replace dbpasswordhere with the password in modsecparse.pl file. At that point, try to re-run the script using this command:

perl -w /etc/cron.hourly/modsecparse.pl

To see if you receive any further email alerts.

Increase /tmp partition size in cPanel and secure it (Cpanel)

1. Stop cpanel, apache (litespeed), mysql services:
/etc/init.d/cpanel stop
/etc/init.d/httpd stop
/etc/init.d/lsws stop
/etc/init.d/mysql stop

2. Umount /tmp and /var/tmp:
umount -l /tmp
umount -l /var/tmp

3. Move /usr/tmpDSK file to another location (just in case you’ll need to mount it somewhere else to preserve data):
mv /usr/tmpDSK /usr/tmpDSK_back

4. Modify /scripts/securetmp to set tmpdsksize to desired size:
vi /scripts/securetmp

$tmpdsksize = 2048000

5. Run:
/scripts/securetmp

6. Start cpanel, apache (litespeed), mysql services:
/etc/init.d/cpanel start
/etc/init.d/httpd start
/etc/init.d/lsws start
/etc/init.d/mysql start

That’s it!

Installing Litespeed In Cpanel

LiteSpeed Web Server is the leading high-performance, high-scalability web server. It is completely Apache interchangeable so LiteSpeed Web Server can quickly replace a major bottleneck in your existing web delivery platform. With its comprehensive range of features and easy-to-use web administration console, LiteSpeed Web Server can help you conquer the challenges of deploying an effective web serving architecture.

LiteSpeed Web Server has superior performance in terms of both raw speed and scalability. Our benchmarks demonstrate that it is more than 6 times faster than Apache. When serving static content, LiteSpeed surpasses well-respected content accelerators including thttpd, boa and TUX. When it comes to dynamic content, LiteSpeed is more than 50% faster in PHP content delivery than Apache with mod_php. Don’t just take our word for it. Download the LiteSpeed free or trial version and experience it for yourself.

These are the commands to install litespeed on your Cpanel in one step , it also compatible with EasyApache , you just have to built it with litespeed .

You can get litespeed 15days trial license from here : 

http://www.litespeedtech.com/trial/license

Install Commands :

cd /usr/src
wget http://www.litespeedtech.com/packages/cpanel/lsws_whm_plugin_install.sh
chmod 700 lsws_whm_plugin_install.sh
./lsws_whm_plugin_install.sh
rm -f lsws_whm_plugin_install.sh

Restoring The Database via SSH/Telnet

Use SSH/Telnet Client, such as PuTTy.
Note:
If your database backup resides on your home computer, you will first have to upload it via FTP to your website
Open your SSH/Telnet client and log into your website. The command line prompt you will see will vary by OS. For most hosting companies, this will bring you into the FTP root folder.

You can either change directoties to wherever the backup is located and type in the following:

mysql -u dbusername -p databasename < backupname.sql

Or if you do not want to change directories and you know the path to where the backup is located, type in the following:

mysql -u dbusername -p databasename < /path/to/backupname.sql

You will be prompted for the database password. Enter it and the database will backup.

If your hosting company has you on a remote MySQL server, such as mysql.yourhost.com, you will need to add the servername to the command line. The servername will be the same as in your config.php. The command line will be:

mysql -h servername -u dbusername -p databasename < backupname.sql

Or:

mysql -h servername -u dbusername -p databasename < /path/to/backupname.sql

Backing Up The Database via SSH/Telnet

Use SSH/Telnet Client, such as PuTTy.

Open your SSH/Telnet client and log into your website. The command line prompt you will see will vary by OS.
For most hosting companies, this will bring you into the FTP root folder.

Type in the following to create a backup in the current directory:

mysqldump –opt -Q -u dbusername -p databasename > backupname.sql

Or to create a backup in a separate directory (signified by /path/to/) type:

mysqldump –opt -Q -u dbusername -p databasename > /path/to/backupname.sql

You will be prompted for the database password. Enter it and the database will backup.

If your hosting company has you on a remote MySQL server, such as mysql.yourhost.com, you will need to add the servername to the command line. The servername will be the same as in your config.php. The command line will be:

Current directory:

mysqldump –opt -Q -h servername -u dbusername -p databasename > backupname.sql

Separate directory:

mysqldump –opt -Q -h servername -u dbusername -p databasename > /path/to/backupname.sql

You can then, if you wish, download the backup to your home computer.

How to convert innodb to myisam in kloxo

At first login into ssh then paste this into ssh window

use ‘sh /script/mysql-convert –engine=myisam’

This will automatically convert all innodb database into myisam