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;

SSH: jailshell: fork: retry: Resource temporarily unavailable – Part 2

To continue to the article of http://www.mickgenie.com/ssh-jailshell-fork-retry-resource-temporarily-unavailable/, I have found out another way to get this issue fixed.

To fix this issue,

1. Log into the WHM.
2. Suspend the account that having these error.
3. Unsuspend the account.

The issue should fixed automatically.

cPanel Horde: DB Error: no such database

Today, one of the customer email found error when trying to access to the Horde Email from cPanel.

A fatal error has occurred
DB Error: no such database
Details have been logged for the administrator.

To get this issue fixed, simply follow the command as below from SSH.

/usr/local/cpanel/bin/update-horde --force

With this command, it will repair and reinstall horde mail.

Howto: Reset iptables firewall

Recently, one of the customer trying to make some changes from the iptables and ended up the server couldn’t access through SSH.

In order to get it done, I have consider to reset the iptables firewall rules with the following command.

# iptables -P INPUT ACCEPT
# iptables -F
# iptables -A INPUT -i lo -j ACCEPT
# iptables -A INPUT -m state –state ESTABLISHED,RELATED -j ACCEPT
# iptables -A INPUT -p tcp –dport 22 -j ACCEPT
# iptables -P INPUT DROP
# iptables -P FORWARD DROP
# iptables -P OUTPUT ACCEPT
# iptables -L -v

How to Install Redmine 1.4 with cPanel 11.32

The reason I repost this article is because my previous article is old enough and I still can see the demand on this task.

– Ruby On Rails 1.8.x enabled, please downgrade to 1.8.7, 1.9.2 or 1.9.3 if your are running higher than that. To check the Ruby version, type “ruby -v” from shell.
– Shell Access(SSH) enabled
– MySQL Enabled
– Rubygems <= 1.8

1. Install gem rails version 2.3.14(exact version), from SSH shell, run

gem install rails -v=2.3.14

2. Install gem rack version 1.1.3, from SSH shell, run

gem install rack -v=1.1.3

3. Install gem rubygems 1.8.23(or higher version, not >= 1.8), from SSH shell, run


If it is not working, refer to http://www.mickgenie.com/how-to-update-rubygems/.
4. Create MySQL database from your cPanel and I assume that you are using the database as detail below.
Database Name: mickgenie_redmine
Username: mickgenie_redmine
Password: StR0NgPa$$w0Rd

Installation Step:
1. Log into the cPanel, click on Ruby On Rails.
2. In the App Name, enter Redmine, environment session select Production and create the App.
3. Click on Create Rewrite button and enter the subdomain or path that needed, then save it.
4. Download Redmine from RubyForce.
5. Upload through File Manager according to the path that you created from the Ruby On Rails.
6. Extract the file to the RoR Apps.
7. Install bundler gem by enter,

gem install bundler

8. Now, run the following command to install all the required gem from Redmine,

bundle install --without development test postgresql

9. Rename the in config/database.yml.example to config/database.yml.
10. Open the database.yml file and look for the production section.
11. Modify the production section as detail below.
adapter: mysql
database: mickgenie_redmine
host: localhost
username: mickgenie_redmine
password: StR0NgPa$$w0Rd

(These information is create as above).
12. Create session store secret.

rake generate_session_store

13. Create the database structure.

RAILS_ENV=production rake db:migrate

14. Create default data.

RAILS_ENV=production rake redmine:load_default_data

15. You have done the installation, just go to cPanel and start the mongrel.

Final Step:
You may now log into Redmine with detail below,
Username: admin
Password: admin

WordPress migration with SSH

Old Site: www.domain.com/blog
Path: /home/domain/public_html/blog
New Site: www.domain.com (Assume the site is empty)
Path: /home/domain/public_html

In order to move the WordPress account manually without any plugin, you may done it through SSH without any trouble.

1.  Log into the SSH.
2.  Copy the folder and file from blog folder to main site.

cp -apr /home/domain/public_html/blog /home/domain/public_html

3. If you using Permalink and having mod_rewrite rule, you may edit your .htaccess file,

vi /home/domain/public_html/.htaccess

4. Change the rewrite rule from,

RewriteEngine On
RewriteBase /blog/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]


RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

1.  Dump the database. Assume your database named wordpress.

mysqldump wordpress > wordpress.sql

2. Change the entry from www.domain.com/blog to www.domain.com.

sed -i 's/www\.domain.\com\/blog/www\.domain\.com/g' wordpress.sql

3. Restore the database back to the domain.

mysql wordpress < wordpress.sql

SSH: jailshell: fork: retry: Resource temporarily unavailable

Today, one of the customer SSH(cPanel) getting error as below when they logged into their jailed shell access.

-jailshell: fork: retry: Resource temporarily unavailable
-jailshell: fork: retry: Resource temporarily unavailable
-jailshell: fork: retry: Resource temporarily unavailable
-jailshell: fork: retry: Resource temporarily unavailable

To overcome the problem, simply run the following command from root.

for i in `ps aux | grep username | awk '{print $2}'`; do kill -9 $i; done

for i in `cat /proc/mounts | grep username | awk '{print $2}'`; do umount $i; done

Where you should replace the username to your created user.

cPanel exim: The server has reached its limit for processing requests from your host

If you get the error like,

451-The server has reached its limit for processing requests from your host.n451 Please try again later.

You may easily fix it by changing your exim configuration.

First of all, log into the WHM and look for Exim configuration Editor. Then look for Advance Editor.

Then you should find something like,

smtp_accept_max = 100

Change it to higher value like 200 and save it.

In case the setting is hide and not able to change from WHM, you may change it from SSH with path as below,


cPanel: Database size is Zero

Wonder why cPanel database size is not calculated and it is always showing zero (0) in the database section?

You may fix this by 2 options,
Option 1:
1. Log into WHM(Web Host Manager).
2. Go to Server Configuration and look for Tweak Settings.
3. Look for “Include databases in disk usage calculations” and enable it.
4. Save it.

Option 2:
1. Log into SSH.
2. Open the file named /var/cpanel/cpanel.config.
vi /var/cpanel/cpanel.config
3. Search “disk_usage_include_sqldbs” and change the value to 1.
4. Lastly, run the command as below,

cPanel: Assigned dedicated IP to subdomain

You might want to assign dedicated IP to your subdomain for some reason such as apply SSL to your subdomain.

If you are using cPanel and wish to set dedicated IP to your subdomain, you will find no else where to do that.

However, this could still be able to fix as this article.

– You have domain domain.com and subdomain blog.domain.com.
– You wish to set dedicated IP for blog.domain.com which originally and result as blog.domain.com resolve to

Continue reading cPanel: Assigned dedicated IP to subdomain