Centos: Check Raid device installed

To check if RAID device install to your server, simply run the following command from your  terminal.

# lspci | grep -i raid

With the above, you may simply get the raid device information.

[email protected] [~]# lspci|grep -i raid
04:00.0 RAID bus controller: LSI Logic / Symbios Logic MegaRAID SAS 2108 [Liberator] (rev 05)

Centos: List SSH user last password changed date with cPanel

To secure your server with cPanel, you might want to consider to request your cPanel user to change your password quarterly.

To get this done, you may consider to use the command name chage.

[email protected] [~]# chage -l username
Last password change                                    : Jul 28, 2012
Password expires                                        : never
Password inactive                                       : never
Account expires                                         : never
Minimum number of days between password change          : 0
Maximum number of days between password change          : 99999
Number of days of warning before password expires       : 7

To list all user Last password change date, you may do with the following command,

for i in `ls -l /var/cpanel/users | grep -vE '(\.|system)'| awk '{print $9}'`;do echo $i&&chage -l $i|grep Last;done;

Howto: Password protected a folder from Apache .htaccess

To protect a folder from your website, you may actually use the htpasswd feature available from the server.

To create a password protected folder to /home/user/public_html/important with user named admin, run the following command.

[[email protected] ~]# htpasswd -c /home/user/public_html/.htpasswd admin
New password:
Re-type new password:
Adding password for user admin
[[email protected] ~]#

Then, add the following code to your .htaccess file located at /home/user/public_html folder.

AuthUserFile /home/user/public_html/.htpasswd
AuthName "important"
AuthType Basic
Require valid-user

Now, access to your folder with the credential created.

MySQL: max_allowed_packet

Some times, when you backup or restore your database table with huge binary data, you will get max_allowed_packet error.

By default MySQL set the max_allowed_packet to 10M.
[email protected] [~]# mysqladmin variable | grep max_allowed_packet
| max_allowed_packet                      | 10485760

To fix it, change your MySQL global variable as step below.
1. Open /etc/my.cnf file.
[email protected] [~]# vi /etc/my.cnf

2. Insert the value as below.
[mysqld]
max_allowed_packet = 64M

3. Save it and restart the MySQL services.