Data Recovery and the Three Golden Backups

Our daily lives are tied to the digital world. Where once we had physical photos, CDs, books and files we now generate and buy the virtual equivalents. We store them on our electronic devices and assume that they will last forever in their digital homes, never needing to use data recovery to restore our virtual assets. But do they last forever?

Data Recovery when Computers Breakdown

A home computer can at any time be holding years of personal information and photos. Items that are irreplaceable to you. How long have you had your computer? The older a machine the greater the chance it will breakdown. When it does break you can feel you have lost part of who you are, this can be a scary time especially if you don’t have a backup. Try and stay calm and read this article from Cheeky Munkey about how to recover data from the hard drive within your computer.

data recovery needed

Avoid Hard Drive Data Recovery with Backups

Never get to the point where you need to recover lost files. Most companies that deal with data will have multiple copies of it. Three copies of any file is considered the minimum required. Just as the hip-hop group De La Soul thought that three was The Magic Number you can also use three as the magic number to prevent the need for data recovery.

  1. The original.
  2. A local copy on transportable media (e.g. USB drive, external hard drive).
  3. An off site copy (e.g. cloud storage or on media stored elsewhere, such as a family members house).

Backups are your files insurance policy for when your computer breaks down or is lost. The Internet has made preserving copies of files easier with services like Apple’s iCloud, Microsoft’s OneDrive, Google Drive and Dropbox where saving to a local folder automatically generates a remote copy. But don’t forget your own local copy on portable media. Ultimately the Internet is run by businesses and businesses have been known to shut off services. So remember your three golden backups for all your content.

Upgrade PHP for CentOS 6 Using Additional Repositories

PHP 5.3 to 5.6 Upgrade for CentOS Using External Repos

CentOS Linux is often an option when configuring a Virtual Private Server (VPS). CentOS is designed for stability, being based upon Red Hat Enterprise Linux (RHEL). This means that although it has a long shelf life it may not have the latest features available to the Linux community. To help overcome this other repositories can be used to update the CentOS installation. Here is a list of some alternative repos for CentOS that provided various updated packages:

CentOS PHP UpgradeOne package that may require updating is PHP. CentOS 6 will be supported until 2020 but comes with PHP 5.3, a few point releases behind the current PHP version. In this article the PHP available in CentOS 6 is updated to a later version. This tutorial is based upon a VPS running a minimal installation of the latest version of CentOS 6, the 64 bit version. The tutorial was tested on a Virtual Machine (VM) duplicate of the VPS on a local machine to ensure that the configuration steps correctly worked before applying the upgrade to live environment. Always have a backup of live data and always test upgrades on a duplicate test system. This minimises the risk to a live system.

It is assumed that the VPS is accessed via a Secure Shell (SSH). This method of access can be duplicated on a local test environment to replicate the real world set up. To upgrade PHP log in to the VPS and install an alternative repo, then use yum to install the later PHP version. Here repositories from Les RPM de Remi is used. Continue reading

Unzip File on VPS? How to Extract a Zip File on a Linux VPS

Tutorial to Upload and Extract a Zip File from Windows to a CentOS VPS

On Linux files are normally compressed individually to create a .gzip version using the gzip utility. Or several files are collected into a Tape Archive, .tar, which is an uncompressed collection of files created using the tar utility. A .tar is then compressed to a .gzip to create a .tar.gz. In Windows files are normally zipped, which is a format that collects and compresses several files into a single .zip file in a single operation.

When managing a Linux based Virtual Private Server (VPS) or other remote Linux machine, such as a web server, there can be occasions when a zip file created on Windows needs to be extracted and managed on the remote Linux machine. This can be done with the Linux zip (to compress) and unzip (to extract) utilities.

Install Zip and Unzip onto CentOS

Upload and unzip file on VPS (CentOS)A VPS may not run a full blown Linux, for example a CentOS VPS may run the minimal CentOS installation for efficiency. In which case the zip and unzip utilities may not be installed. These utilities can be installed on CentOS using yum:

Continue reading

CentOS 6 to CentOS 7 Upgrade Using Red Hat Upgrade Tool

CentOS 7 Supports In-Place Upgrading from CentOS 6.x for 64-bit Versions

This article covers upgrading a minimal CentOS 6.x system to CentOS 7. CentOS is a popular GNU/Linux OS for servers (including web servers) and workstations. Popular because it is a community based version of RHEL. CentOS is often an OS option when purchasing and setting up a VPS. The current major version of CentOS is version 7. CentOS 7 can be installed via an in-place upgrade over CentOS 6. However, CentOS 7 is only a 64-bit OS and therefore the system being upgraded has to be running 64-bit CentOS 6. To check if CentOS is 64-bit or 32-bit use the uname command with the -p option (p for processor):

[root@servername ~]# uname -p
x86_64

The 64-bit CentOS will display x86_64 and 32-bit will display i686.

CentOS 6 to CentOS 7 UpgradeWords of caution. If your system has been highly customised then performing an in-place upgrade from CentOS 6 to 7 may not be successful. In this case, as for upgrading a 32-bit system, a data backup, new CentOS 7 installation and data restore will be required. Do you need CentOS 7 now? There is also no need to rush to upgrade to CentOS 7. CentOS 6 will be receiving updates until the end of 2020. This article is for informational and test purposes only. You are responsible for you own actions and an in-place upgrade from CentOS 6 to CentOS 7 is probably more trouble than doing a fresh CentOS 7 install and data restore. For example upgrading a minimal CentOS 6.6. to CentOS 7 may not work according to this bug report.

The other consideration is whether the new CentOS 7 features will hinder operation of your system. The new features may require changes to the normal workflow or they may be incompatible with software that is being used on the system. Whilst the CentOS 7 Release Notes list some major changes the RHEL 7 Release Notes has a detailed discussion. Continue reading

hiberfil.sys Windows 8.1 Delete to Free Up SSD Space

Disable Hibernation on Windows 8.1 to Remove hiberfil.sys for More Disk Space

This article provides a tutorial on removing the Windows hibernation file to free up disk space when a small solid state disk (SSD) is used as the system drive. Please ensure you have a backup of any data and files you need to keep before changing system configurations. This article is for information only. System configurations can vary widely, therefore any changes made are at your own risk. If you’re confident with computers and understand the meaning of the hiberfil.sys file you can skip to the end of the article for the relevant command, which is to run powercfg -h off at the administrator’s command prompt, otherwise read on for a better understanding.

Background

Low Disk Space on a Windows SSDApart from low end systems a SSD drive is standard fitting to most computers and laptops. An SSD is also a common upgrade to older systems. A SSD is more expensive than a hard disk drive, as a result small capacity SSDs (less than 128 GB) may be used to keep costs down. Windows 8.1 requires 20GB for installation, modern computing demands soon eats into the the remaining space. A system can be configured to use a small SSD for the Windows system and a large multi-terabyte  hard drive for data storage (see Move My Documents and Other Personal Folders). Despite this, or if a second drive is not an option, the SSD may fill up quickly with normal use. Once the SSD is full the computer or laptop will not function properly, may not boot up, or show error messages at boot time. The worst case scenario is data corruption and loss, or even disk failure, when applications cannot handle running with no disk space available. Continue reading

Visualization for Cyber Security Conference List of Papers

All Papers from the Annual Visualization For Cyber Security Symposium

Whilst researching novel methods for visualising data from computer security systems the VizSec conference proceedings looked interesting. VizSec is short for Visualization for Cyber Security. This is an annual symposium dedicated to the use of visualisation techniques to help with the complexity of monitoring the large modern systems we all use. System security has become a big data problem and only efficient data analytics will help manage it.

The 11th International Symposium on Visualization for Cyber Security takes place in November 2014. The papers from the previous 10 years of symposiums are available from different institutional or publisher web sites. This means there is not a single search available to get one list of all the papers presented at VizSec over the years. Therefore visits to several web pages and web sites are required to put together the list of all papers presented at VizSec. Since this has now been done that list is published here. Therefore you don’t need to repeat the work. Continue reading

Webmin CentOS Install for Easier VPS Management

Manage a CentOS VPS Using Webmin for System Administration

A Virtual Private Server (VPS) is a cost effective way to host web and cloud based solutions or high volume web sites. A VPS provides more resources (memory, processing power and disk space) than shared hosting without the cost of leasing dedicated hardware (although a VPS will not be as powerful as a dedicated machine). Some VPS packages only provide a minimal Linux system. Access to that minimal system is usually via a secure shell (SSH). Managing a Linux system remotely over SSH can be cumbersome. To make the system administration easier a web based management tool is useful. A commercial tool such as cPanel is often provided at extra cost. Open source alternatives like ZPanel and Webmin are available. In this tutorial article the Webmin system administration tool will be installed on a CentOS based VPS. CentOS, based on a Red Hat Linux distribution, is commonly available for VPS packages. This article assumes that the minimal installation of CentOS is used for the VPS operating system. The minimal CentOS does not have the desktop environment installed. The steps for the Webmin CentOS install are:

  1. Update CentOS using yum update.
  2. Add Webmin to the CentOS yum repositories.
  3. Add the Webmin package PGP key to the RPM keyring.
  4. Allow Webmin through the CentOS iptables firewall.
  5. Install Webmin using yum install webmin.
  6. Start Webmin and start using it.

Webmin Install Running on CentOS Continue reading

Change SSH Port from Default for CentOS Security Improvement

Help Harden a CentOS Server, Change SSH Port from Default Port Number 22

Edit the SSH configuration file to modify SSH port number. The configuration file is sshd_config. Adding Port XXXX where XXXX is the required port number. Then update SELinux and iptables. This is done to help harden CentOS against the less skilled hackers. The Secure Shell (SSH) is used to access a CentOS Server from another computer. For example when accessing a Virtual Private Server (VPS) to perform configuration changes. CentOS is a common option for a VPS operating system. This tutorial provides details on changing the SSH default port number for a CentOS server.

Steps to Change the CentOS SSH Port Number

The following steps are performed to change default SSH port number on CentOS:

  1. Login to the CentOS server.
  2. Back up then edit the /etc/ssh/sshd_config file.
  3. Add the line Port XXXX to the file, where XXXX is the new port number.
  4. Update the SELinux policy for the new SSH port.
  5. Update the iptables firewall rule for the new SSH port.
  6. Restart the services or the server.
  7. Check the changes worked by connecting on the new port.

Practice and Keep A Back Up

CentOS Logo

It is recommended to practice the instructions that follow on a local test environment before doing it on a live machine. This ensures familiarity with the process and reduces the risk of making mistakes on a live server. CentOS can be configured on a local Virtual Machine (VM) to practice these changes (see the Further Information section at the end of the article). For a remote VPS if you make a mistake reconfiguring the SSH port you may not be able to connect to it. It will require resetting via your service provider’s control panel. Always ensure you have a backup of any data that needs to be kept in the event the VPS needs to be reset. If SSH is the only option for configuration of a remote VPS consider other hardening options first, for example adding a sudo user for SSH login and removing the root user login over SSH. This article uses the shell (command line terminal) to change the CentOS configuration, based on a minimal CentOS install.

Edit the File sshd_config

To change the SSH port number edit the /etc/ssh/sshd_config file. Start by taking a copy in case anything goes wrong. For all commands in this article only enter the text after the # or $ prompt character, as seen on the terminal screen. Here’s the command to copy sshd_config to sshd_cfg_old:

# cp /etc/ssh/sshd_config /etc/ssh/sshd_cfg_old

Editing is done with vi or nano. On a minimal CentOS install, typical for a VPS, nano will not be installed by default. To edit sshd_config using vi:

# vi /etc/ssh/sshd_config

Or if logged in as a user with sudo ability:

$ sudo vi /etc/ssh/sshd_config

Add the Required Port Number

Select a new port number above 1024, one that is meaningful to you so it is remembered, or pick a random one. See List of TCP and UDP Port Numbers on Wikipedia. Some admins just double up port numbers, e.g. 22 becomes 2222, but that is familiar to hackers so pick something else, e.g. pick a memorable year and double it. For example 2×1066 is 2132, so port 2132 can be remembered as “Twice Battle of Hastings“.

The Port line should be in the first page of the file, as either Port 22 or commented out as #Port 22. Go to the line. Press Insert to enter edit mode. Remove the # if present and change the port number to the required value. Press the Esc key to return to command mode and enter :wq to write out the file and quit vi.

ssh_port_config

Update SELinux with the New Port Number

If the Security Enhanced Linux module (SELinux) is running then update selinux with the new port number. Failure to update SELinux for the new port will result in a Permission denied showing in the SELinux log.  To check that selinux is enabled run sestatus:

# sestatus
SELinux status: enabled
SELinuxfs mount: /selinux
Current mode: enforcing
Mode from config file: enforcing
Policy version: 24
Policy from config file: targeted

Use semanage to add the new port number to SELinux, see the article RHEL 6: semanage SELinux Command Not Found on how to install the command if not present (e.g. if using the CentOS minimal install). For this article this command was used to check the package for semanage:

# yum provides /usr/sbin/semange

And this command to install it:

# yum -y install policycoreutils-python

The port numbers for SELinux can be displayed using a semanage command (pipe to less to page through the list):

# semanage port -l | less

In the list of ports will be found ssh_port tcp 22. Use semanage to add the new port number:

# semanage port -a -t ssh_port_t -p tcp 2132

Update Firewall Rules for the New Port Number

The iptables firewall rules are listed using:

#iptables -L

There will be a rule showing that SSH is only allowed on port 22. This needs changing to the new port number. Use vi to open /etc/sysconfig/iptables:

# vi /etc/sysconfig/iptables

Go to this line:

-A INPUT -p tcp -m state –state NEW -m tcp –dport 22 -j ACCEPT

Change 22 after –dport to the new port number, e.g. 2132 (press Insert to enter edit mode in vi):

-A INPUT -p tcp -m state –state NEW -m tcp –dport 2132 -j ACCEPT

Save and exit (Esc key then :wq). Restart iptables:

# service iptables restart

Restart SSH

With the SSH config file changed, SELinux updated and iptables rules updated SSH can be restarted:

# /etc/init.d/sshd restart

Restarting CentOS

As an alternative to restarting iptables and ssh restart the the CentOS server:

# reboot

or

# shutdown -r now

Login to CentOS Using SSH to Test The New Port

On a Windows system a program such as PuTTY can be used to access a CentOS server using SSH. In this example the port number is 2132. To connect with the new port number enter it in the Port box.

PuTTY to SSH into different port

With the host name or IP address also entered select Open. The terminal prompt should appear allowing for a normal login.

(Note: If accessing a CentOS VPS on a VirtualBox virtual machine on the local computer you will need to change the Network Address Translation port from 22 to the new number, see the third article listed below.)

Further Information

CentOS Version Command and Update CentOS to New Version

View the CentOS Version and Update with Shell Commands

CentOS is a popular Linux Operating System for enterprise computing, web servers and Virtual Private Servers.

In this article:

  • View CentOS version
  • Check if CentOS is 64-bit or 32-bit
  • View the Centos server Name
  • View CentOS kernel version
  • View list of available CentOS updates
  • Updating CentOS
  • Rebooting CentOS
  • Listing CentOS installed packages

In these examples root is the logged in user, in practice a different superuser will normally be used when maintaining a server. These commands are executed in the shell.

View CentOS Version

When CentOS boots the version is briefly displayed on a boot screen and may be configured to show on the shell login but will probably show the kernel version:

Centos 
Kernel 2.6.32-431.el6.i686 on an i686

servername login:

Once logged in at the CentOS shell prompt find the CentOS version using:

[root@servername ~]# cat /etc/*release
CentOS release 6.5 (Final)

or

[root@servername ~]# cat /etc/issue
CentOS release 6.5 (Final)

or

[root@servername ~]# cat /etc/redhat-release
CentOS release 6.5 (Final)

Check if CentOS is 64-bit or 32-bit

To check if CentOS is 64-bit or 32-bit use the uname command with the -p option (p for processor):

[root@servername ~]# uname -p
x86_64

The 64-bit CentOS will display x86_64 and 32-bit will display i686.

Display the CentOS Server Name (Host Name)

Use hostname to display the systems name:

[root@servername ~]# hostname
servername.server

Display the CentOS Kernel Version

Use uname to see the kernel version:

[root@servername ~]# uname -r -v
2.6.32-431.el6.i686 #1 SMP Fri Nov 22 00:26:36 UTC 2013

List Available CentOS Updates

List available updates using yum, here piped (using |) to less to view one screen at a time using the space bar. Use q to quit the listing:

[root@servername ~]# yum list updates | less

Update CentOS

Update CentOS using yum, package downloads may need to be confirmed:

[root@servername ~]# yum update

(Note: After confirming the update packages will download, extract and install. If this fails you may see messages such as “Trying other mirrors”“Error Downloading Packages” and “[Errno 256]”. Use the command “yum clean metadata”  and try “yum update” again. If it still reports errors use the command “yum clean all” and try again.)

Rebooting CentOS

Restart CentOS:

[root@servername ~]# reboot

or

[root@servername ~]# shutdown -r now

One logged back in use the commands above to check the updated versions:

[root@servername ~]# uname -r -v
2.6.32-504.3.3.el6.i686 #1 SMP Tue Dec 16 22:55:44 UTC 2014

[root@servername ~]# cat /etc/issue
CentOS release 6.6 (Final)

List CentOS Installed Packages

List installed packages using yum, piped to less to view a page at a time (to quit):

[root@servername ~]# yum list installed|less

Further Information

For more information on CentOS see their Wiki and the CentOS web site at centos.org.

See also: