Categories

A sample text widget

Etiam pulvinar consectetur dolor sed malesuada. Ut convallis euismod dolor nec pretium. Nunc ut tristique massa.

Nam sodales mi vitae dolor ullamcorper et vulputate enim accumsan. Morbi orci magna, tincidunt vitae molestie nec, molestie at mi. Nulla nulla lorem, suscipit in posuere in, interdum non magna.

How to Change Your Default Timezone in .htaccess (for hosting account)

 

 

You can change your hosting account time zone through .htaccess. By default this .htaccess file would be hidden text file under your hosting account. Please follow below instructions to edit / update .htaccess file to change DNS Zone:

Update timezone in .htacccess file using File Manager (cPanel hosting account)

  • Logon to your cPanel acccount >> File Manager
  •  if you not able to see .htaccess file, please click on Settings in File Manager and Select ‘Show Hidden Files’. Save it.
  • Select .htacccess file and click on Edit button
  • Type below lines and click on save button to save changes:

                  #Set default time zone for hosting account

         SetEnv TZ America/NewYork

  • 4: All is done.

How to change timezone in .htaccess through ssh / command shell

  • If you have access to SSH, please logon to your server with cPanel account
  • Edit .htacccess with your favorite shell editor , like nano or vi and save changes

    nano /home/yourcpaccount/public_html/.htaccess

How to Change Default Timezone in php.ini (custom php)

You can change your hosting account time zone for PHP applications through custom php.ini under your hosting account. You can place custom php.ini under root directory of your php application (for PHP 5.3 or latest versions). Please follow below instructions to edit / update .htaccess file to change DNS Zone:

 

Update timezone in custom php.ini file using File Manager (cPanel hosting account)

  • Logon to your cPanel acccount >> File Manager
  •  if you not able to see php.ini file, please click on Settings in File Manager and Select ‘Show Hidden Files’. Save it.
  • Select .htacccess file and click on Edit button
  • If there is no php.ini file listed, click on new file button in File Manager
  • Type below lines and click on save button to save changes:

                  #Set default time zone for PHP

        date.timezone = “US/Central”

  • 4: All is done.

You can see list of supported time zones here: http://www.php.net/manual/en/timezones.php

How to change timezone in php through ssh / command shell

  • If you have access to SSH, please logon to your server with cPanel account
  • Edit .htacccess with your favorite shell editor , like nano or vi and save changes

    nano /home/yourcpaccount/public_html/php.ini

How to block an IP(IP range) in CSF

You can block a single IP address or IP range from WHM interface or from the server bash/ SSH shell.

Block an IP from WHM:

    1. Log in to WHM as root.
    2. Navigate to Plugins section >> ConfigServer Security & Firewall 
    3. Explore for the Quick Deny section/button >> Enter the IP address or IP range in the red edit box that you willing to block. If you want, you can also add a comment in the next edit box.
    4. Click the Quick Deny button .
    5. The IP will be added to the CSF block list – /etc/csf/csf.deny file – and you will see a confirmation message:
    6. Click the Return button to return to the CSF main page.

 

Block an IP address / IP address range from server command line/ SSH:

  1. Log in to the server via SSH as root

Use the command: csf -d IP (replace IP with the IP address you willing to block , see examples below):

csf -d 11.22.33.44

You can also block IP blocks, like:

csf -d 11.22.33.0/24
csf -d 145.124.0.0/16


Or using your favorite editor edit /etc/csf/csf.deny directly to add IP addresses / IP ranges at once!


How to remove ipaddress block from new cphulk (through SSH on cPanel server)

It’s by design the IP addresses are unreadable in the database. The “Blacklist Management” tab in the cPHulk interface allows you to remove an IP address from the interface. You can also unblock an IP address from the iptables block out with a command such as:

Code:
/scripts/hulk-unban-ip IP-HERE

** Please change IP-HERE with IP address

You can find updated documentation on cPHulk at:

cPHulk Brute Force Detection

How To Upgrade to ubuntu16.04 LTS from ubuntu 14.04 LTS from SSH

This article will describe the steps to upgrade ubuntu 14.04 LTS to ubuntu 16.04 LTS from command line (SSH/ or server cosnole)

Precaution:

  • Don’t attempt upgrade for system with RAM below 1GB, Attempting to upgrade a server with less than 1GB of RAM may result in database corruption.
  • Please take snapshot of your server before you start upgrade process.
  • All of apps and services will be down during upgrade process.
  • Upgrade process would take few minutes to several hours, all depends on your server network connection speed and server hardware.

Preparation to upgrade:

SSH to your server as root and run below command to make sure your server is ready to upgrade, if you see error messages or any command fails, don’t start upgrade process:

sudo apt-get update && sudo apt-get dist-upgrade
sudo dpkg --configure -a

If you don’t see any error messages by executing above commands, you are ready to upgrade your server, follow commands as below:

sudo do-release-upgrade -f DistUpgradeViewNonInteractive

At the completion of upgrade process you would see prompt to remove obsolete packages, just enter ‘y’ after this upgrade process is complete .

Restart your server

sudo init 6

Now your server is upgraded to latest release.

Once upgrade complete and server successfully booted with new OS, be advised to create new snapshot of your server.

If your upgrade fails due to any reason you can restore from snapshot of old release that you generated before to start your OS upgrade process.

Ubuntu 16.04 release notes: https://wiki.ubuntu.com/XenialXerus/ReleaseNotes

Move cagefs-skeleton directory from /usr/share to another partition

What is CageFS?

cagefs is a virtualized file system and a set of tools to lock each cpanel/ system user in its own space called ‘cage’. Each user will have its own fully functional CageFS, with all the system files, tools, etc…  For a in cagefs only safe binaries or custom binaries enabled by root should available. CageFS user will be restricted to see other users.

CageFS create an individual namespace for each user, this technique make it possible to hide other user and their files. CageFS create  high level of isolation. The safe files for cageFS users are created under default location /usr/share/cagefs-skeleton.

Sometimes you might need to move cagefs-skeleton from /usr/share to another partition like /home due to low free disk space available in the /usr partition. Please find below steps to migrate cagefs_skelton from default location i.e. /usr/share/cagefs_skelton.

How to move cagefs_skelton from default location?

  •  If /usr/share/cagefs-skeleton already exists:

$ cagefsctl –disable-cagefs 
$ cagefsctl –unmount-all
# To ensure that the following command prints empty output: 
$ cat /proc/mounts | grep cagefs 
# if you see any cagefs entries, execute “cagefsctl –unmount-all” again.
$ mv /usr/share/cagefs-skeleton /home/cagefs-skeleton 
$ ln -s /home/cagefs-skeleton /usr/share/cagefs-skeleton
cagefsctl –enable-cagefs

  •  If /usr/share/cagefs-skeleton is not created yet (cagefsctl –init wasn’t executed), then execute:

$ mkdir /home/cagefs-skeleton 
$ ln -s /home/cagefs-skeleton /usr/share/cagefs-skeleton 
$ cagefsctl –init

On cPanel servers, if you place skeleton into /home directory, then you should configure the following option:

In cPanel WHM choose Server Configuration and go to Basic cPanel/WHM Setup, then in Basic Config change Additional home directories default value to blank (not “home”).

Note: If this option is not set, then cPanel will create new accounts in incorrect places.

 

Ref: https://docs.cloudlinux.com/index.html?moving_cagefs-skeleton_directory.html