How to Update your EHCP force Version.
Posted: Wed Jan 17, 2018 5:14 pm
When it comes to updating your EHCP force installation, Please DO NOT use the update script from the EHCP force website as this will undo some of our important fixes and changes.
You must use the upgrade script provided in this post to update EHCP force.
It is important that you keep your server updated with the most recent version of EHCP force.
To check if a new version has been released since your last updated (or installed) EHCP force check this link.
https://ehcpforce.ezpz.cc/forums/index.php?topic=15.0
Please Note:
This EHCP force update script was changed on the 6th May 2025.
If you created your script before then please delete it (sudo rm /var/www/new/ehcp/scripts/updateehcp.sh) and then re-create it.
The 6th May 2025 script, contains a new “Fail Safe”, for sending emails via Roundcube, which means that in the event of an SMTP auth issue, you will still be able to send emails from Roundcube.
Whilst running EHCP force update (just like the installer), you WILL see errors on the screen, you should ignore all of these errors, most of them are just due to EHCP force working on more that one Linux distribution, and therefore not significant to us.
Ok, lets do this.
We are going to create an update script file so in the future we can use a single line to update EHCP force.
Logon to your server using your PC and putty.
Issue this command to create a new script file.
sudo vi /var/www/new/ehcp/scripts/updateehcp.sh

Press I for insert, and paste in this code
Please note, the next screenshot may look deferent, due to future updates to this script.

Save and exit (Escape :w (enter) :q (enter))
As this is a new file we have to give it permission to execute so issue this command.
sudo chmod +x /var/www/new/ehcp/scripts/updateehcp.sh
Ok, that is our update script created (we don’t need to repeat that step when we update EHCP force in the future).
So from now anytime EHCP force needs updating simple issue the following command.
sudo /var/www/new/ehcp/scripts/updateehcp.sh
When the update completes, you be asked to press any key to reboot, so please do so.
Job done!
You must use the upgrade script provided in this post to update EHCP force.
It is important that you keep your server updated with the most recent version of EHCP force.
To check if a new version has been released since your last updated (or installed) EHCP force check this link.
https://ehcpforce.ezpz.cc/forums/index.php?topic=15.0
Please Note:
This EHCP force update script was changed on the 6th May 2025.
If you created your script before then please delete it (sudo rm /var/www/new/ehcp/scripts/updateehcp.sh) and then re-create it.
The 6th May 2025 script, contains a new “Fail Safe”, for sending emails via Roundcube, which means that in the event of an SMTP auth issue, you will still be able to send emails from Roundcube.
Whilst running EHCP force update (just like the installer), you WILL see errors on the screen, you should ignore all of these errors, most of them are just due to EHCP force working on more that one Linux distribution, and therefore not significant to us.
Ok, lets do this.
We are going to create an update script file so in the future we can use a single line to update EHCP force.
Logon to your server using your PC and putty.
Issue this command to create a new script file.
sudo vi /var/www/new/ehcp/scripts/updateehcp.sh

Press I for insert, and paste in this code
Code: Select all
#!/bin/bash
#
# EHCP force update script by Rob Swan (WA) V.1.25
#
#Check for root-----------------------------------------------------------------
ROOTUID="0"
if [ "$(id -u)" -ne "$ROOTUID" ] ; then
echo "This script must be executed with root privileges."
exit 1
fi
# Check for Ubuntu updates ----------------------------------------------------
apt-get update
apt-get upgrade --assume-yes
apt-get dist-upgrade --assume-yes
#-------------------------------------------------------------------------------
#
# Protect the Squirrelmail installation ---------------------------------------
mv /var/www/new/ehcp/webmail2 /var/www/new/ehcp/hidemail2
#-------------------------------------------------------------------------------
#
# Protect the Install.lib ------------------------------------------------------
cp /var/www/new/ehcp/install_lib.php /var/www/new/ehcp/install_lib.hide
#-------------------------------------------------------------------------------
#
# I have trust issues, protect the saslauthd config
cp /etc/pam.d/smtp /etc/pam.d/smtp.hide
cp /etc/default/saslauthd /etc/default/saslauthd.hide
cp /etc/postfix/sasl/smtpd.conf /etc/postfix/sasl/smtpd.hide
cp /usr/lib/systemd/system/saslauthd.service /usr/lib/systemd/system/saslauthd.hide
#------------------------------------------------------------------------------
#
# Run the EHCP force update----------------------------------------------------
cwd=$(pwd)
mkdir -p ~/Downloads
sudo apt-get -y install git
cd ~/Downloads
if [ -e "ehcp" ]; then
rm -rf "ehcp"
fi
git clone "https://github.com/earnolmartin/EHCP-Force-Edition.git" "ehcp"
cd ehcp
cd ehcp
bash "ehcpforceupdate.sh" "update"
cd $cwd
#-------------------------------------------------------------------------------
#
# Re-activate Squirrelmail------------------------------------------------------
rm -rf /var/www/new/ehcp/webmail2
mv /var/www/new/ehcp/hidemail2 /var/www/new/ehcp/webmail2
chown root:www-data -R /var/www/new/ehcp/webmail2
chmod 754 -R /var/www/new/ehcp/webmail2
chown ftp:www-data -R /var/www/new/ehcp/webmail2/data
#-------------------------------------------------------------------------------
#
# Restore install.lib-----------------------------------------------------------
mv /var/www/new/ehcp/install_lib.hide /var/www/new/ehcp/install_lib.php
#-------------------------------------------------------------------------------
#
# Restore saslauthd
service saslauthd stop
mv /etc/default/saslauthd.hide /etc/default/saslauthd
mv /etc/postfix/sasl/smtpd.hide /etc/postfix/sasl/smtpd.conf
mv /usr/lib/systemd/system/saslauthd.hide /usr/lib/systemd/system/saslauthd.service
systemctl daemon-reload
service saslauthd start
#-------------------------------------------------------------------------------
#
# saslauthd Fail Roundcube Sending Fail Safe
sed -i "s/'%u';/'';/g" /etc/roundcube/config.inc.php
sed -i "s/'%p';/'';/g" /etc/roundcube/config.inc.php
#-------------------------------------------------------------------------------
#
#Clean Up-----------------------------------------------------------------------
apt autoremove --assume-yes >/dev/null 2>&1
apt autoclean --assume-yes >/dev/null 2>&1
#-------------------------------------------------------------------------------
#
#Tell the user its time to reboot-----------------------------------------------
echo ""
read -p "Update Done, Press any key to reboot this server." -n1 -s
echo ""
shutdown -r now
#-------------------------------------------------------------------------------
#
#ALL DONE!

Save and exit (Escape :w (enter) :q (enter))
As this is a new file we have to give it permission to execute so issue this command.
sudo chmod +x /var/www/new/ehcp/scripts/updateehcp.sh
Ok, that is our update script created (we don’t need to repeat that step when we update EHCP force in the future).
So from now anytime EHCP force needs updating simple issue the following command.
sudo /var/www/new/ehcp/scripts/updateehcp.sh
When the update completes, you be asked to press any key to reboot, so please do so.
Job done!