Fix Heartbleed bug by quick update for openSSL on apache

yum update openssl* -y
This will update openSSL to the newest version for apache on CentOS

To check your server to see if it’s vulnerable to the Heartbleed bug: https://www.ssllabs.com/ssltest/

Regex tips and tricks

To search for numbers (regex still considers them text)

[0-9] means any single digit with the character value of 0 – 9. (Won’t match letters)

  • ex: to find or match: 2011/02/10/ use: 201[0-2]/[0-9][0-9]/

Great guide on regex:

http://www.regular-expressions.info/numericranges.html

Command line for cpanel – restart whm cpanel server

from: http://cpanel.net/system-administrators/command-line-scripts/

Prefer Command Line to a GUI? You Can Access 98 Percent of WHM Functionality From the Command Line


Using one many automation scripts available in the /scripts folder, allows you to quickly configure, troubleshoot and execute powerful commands on your cPanel & WHM server by using one of the many automation scripts available in the scripts folder. Here are some of the more popular command line scripts available via cPanel & WHM:

easyapache
This powerful script allows you to compile, upgrade, and re-install Apache, PHP, and various modules. EasyApache makes it simple to run multiple PHP versions on your server and compile Apache and PHP modules.
check_cpanel_rpms
The check_cpanel_rpms script validates cPanel-managed RPMs and provides a way to reinstall these RPMs if they have been altered.
*up
The *up script is used to manually update the various services on your cPanel & WHM server using various forms such as mysqlup, phpup and eximup. Although you can configure your services to update with cPanel, *up can be used for finer control.
restartsrv_*
The restartsrv_* script can be used to manually restart the various services on your cPanel server. This is the recommended method for restarting services through SSH.
addpop
The addpop script can be used to add pop email addresses through SSH. Through interactive prompts, addpop will create the new address and set the email address password under the proper user account.
delpop
The delpop scripts can be used to remove email accounts through SSH. Similar to the addpop script, delpop will remove the email address from the proper account.
wwwacct
The wwwacct script can be used to create accounts for your cPanel & WHM server. We’ve made this script full-featured in that you can define all of the parameters for the new account as you would through WHM.
killpkg
The killpkg account can be used in similar fashion as the wwwacct script to automate removal of accounts.
restorepkg
The restorepkg script can be used to manually restore an account from backup.
cpbackup
The cpbackup script can be used to manually trigger system wide backups on your cPanel & WHM server.
pkgacct
The pkgacct script is used within the cpbackup script and can be manually executed to create specific account or system wide backups.
upcp
The upcp script can be used to trigger the update process on your server. You can also configure whether you want server software and the OS updated by the upcp script.
setupmailserver
The setupmailserver script allows you to switch between courier and dovecot, or disable POP3 and IMAP functionality altogether.
setupftpserver
The setupftpserver script allows you to switch between pure-ftpd and proftpd, or disable ftp functionality altogether.
setupnameserver
The setupnameserver script allows you to switch between bind and nsd, or disable nameserver functions altogether.
suspendacct
The suspendacct script can be used to automate suspension of accounts on your cPanel & WHM server.
unsuspendacct
The unsuspendacct script can be used to automate unsuspension of accounts on your cPanel & WHM server.

Using a combination of these scripts, you can automate tasks on your cPanel & WHM server to meet your specific hosting needs.

 

Ubuntu default login password

When you first start a live cd:

Username: Ubuntu

Password: nothing

Literally, don’t type a password and just click the login.

If you want to stay logged in and not have to sudo all over the place:

Ubuntu Live CD root password

Ubuntu root

sudo command (you must do this every time you issue a command)

sudo -i command (this gives you persistent access)

If you are launching a graphical app like Nautilus (file manager) use gksudo instead of sudo. This makes it so that your files created in Nautilus, Konqueror, or Dolphin are owned by your user and not root.

If you are using KDE instead of gnome, use kdesudo instead of sudo to launch graphical applicaitons. Example:

kdesudo kate ~/myfile.txt

OR:

Create an Ubuntu root account with password easily.

This post also shows how to create a linux cd root password.

Apache httpd.conf – ServerSignature Off ServerTokens Prod

To supress apache returning information about itself in the response headers add these 2 lines to httpd.conf:

ServerSignature Off
ServerTokens Prod

This can be done with WHM without editing the httpd.conf file:
Main >> Service Configuration >> Apache Configuration

Unpredictable drive errors

from my favorite disk imaging program support website, a very helpful guide to fixing disk read or write errors due to glitchy items like bad IDE cables: http://www.terabyteunlimited.com/kb/article.php?id=152

Image Validation Fails with Image Stream Corrupt or Byte-for-Byte Validation Failure Message

This problem can be caused by overclocking, overheating, a hardware problem, or a BIOS or firmware bug or configuration issue.

To determine if the mainboard, memory, or CPU is at fault:

  • Download and run either the Microsoft Windows Memory Diagnostic or memtest86 (or try both of them).
    • If you use the Windows Memory Diagnostic, run the extended tests overnight.
    • If you use memtest86, run all seven of the default tests and allow it to run overnight.

If the memory diagnostic does not report any errors, check the following:

  • Run chkdsk /f on both the source drive and the drive holding the backup image. Important: Only run chkdsk if the memory diagnostic did not report any errors. Running chkdsk on a system with bad memory can result in data corruption.

    Start a Command Prompt and then run chkdsk x: /f where x: is the drive to check.
    For example: chkdsk c: /f

    Note: If running Windows Vista or Windows 7, you must run chkdsk from an Administrator Command Prompt.

  • If the problem is occurring when saving images to an optical drive, try burning at a slower speed and/or updating the drive’s firmware, if possible. Also, please refer to the article Message “Unable to read from file” when Performing Image Validation or Restore, if applicable.
  • If you are overclocking, revert your settings to the defaults and determine if the problem goes away.
  • If you are using a non-standard, third-party system BIOS or device firmware, switch to the latest final version of the manufacturer-supported BIOS or firmware, reset all BIOS settings to the defaults (referred to as a “clearing the CMOS” procedure by some mainboard manufacturers) and determine if the problem goes away.
  • If you have recently flashed to a different version of your system BIOS or the firmware of the controller to which your drive is connected (even if you the version used is a manufacturer-supported version), try reverting to the BIOS or firmware version you were using before (or the latest version) and determine if the problem goes away.
  • If you are having the problem with an IDE drive and you are using an IDE cable that is greater than 18 inches in length, replace the cable with one that is 18 inches or shorter in length.
  • Switch to an 80-conductor IDE cable.
  • If you have an IDE drive that is set to master (and/or is the only device on the IDE cable) ensure that it is connected to the end of the IDE cable.
  • If you are using a USB drive, please see the following KB article:
    Troubleshooting USB Drive Connection and Performance Issues



  • Ensure that your system, including any applicable drives, are not running at temperatures that exceed the manufacturer specifications.  If any temperatures are high, addtional case fans may be needed.
  • The drive may have weak sectors.  Try a thorough test with a utility provided by the drive manufacturer, with SpinRite, or with a similar utility.


If none of the above helps, the problem may be due to weak sectors on the drive surface. If the issue you are having involves a hard drive, download and run the hard drive manufacturer’s diagnostic utility or a third-party utility designed to scan and repair hard disk surfaces. Below are links to some major hard drive manufacturer’s home pages:

ExcelStor
Fujitsu
Hitachi
Seagate/Maxtor
Samsung
Seagate
Sony
Toshiba
Western Digital

If you still have not narrowed down the problem, try adjusting the system BIOS parameters below, for the drive(s) with which you are experiencing the problem. These settings, if available, are typically found under “Integrated Peripherals” or in the “Drive Configuration” section.

  • Disable “Block mode”
  • Disable “32-bit access”
  • Switch to a different PIO mode
  • Switch to a lower UDMA mode, if using UDMA

Linux root password for live session

When there is no root password for a live session in linux you can type:

sudo passwd root

Then enter a new unix password

Then type su as normal to gain root access.
su

Another way: in Debian there is no root user only type
#sudo su -

If you need root access in Ubuntu then it’s different, there is no actual root, with Ubuntu you need to do sudo, this line shows you how.

Ubuntu error splicing file permission denied

If you have the error on a linux system: “error splicing file permission denied” while trying to move, copy or delete a file, most likely you are trying to copy a windows encrypted file. It will not show as encrypted in linux and the permissions will look exactly as your others that do copy properly.

The best way to take care of this is to boot into windows that encrypted the file in the first place, and right click “properties”, then uncheck “encrypted”. The files will decrypt if you logged in the windows that originally encrypted it.

I had accidentally done this and the only way I noticed was the file copy error in Ubuntu, then when booting to windows, the particular folder full of files were all in green text instead of black. If they were in blue, that would mean that they are compressed.

Howto: Ubuntu Live CD root password for default user Ubuntu

sudo passwd ubuntu

Then create your password, you will need to already be in Terminal ;-)

Ubuntu user: You will have to sudo once you login to do anything powerful

ubuntu default root password:

To create a usable root user’s account on a live cd, you can set the root password then su. This has not been possible in previous versions of Ubuntu as their user model made you remember to sudo before each command requiring root access.

sudo passwd root

It’s easier just to sudo command for one time use, instead of creating a root user to su to.

As of Ubuntu 9.10, I haven’t been able to login with “demo” or “Ubuntu” as the password for live session username “Ubuntu”.

If you are running most other types of linux like Debian, Red Hat, Mepis, Suse and others, they have an actual root user with an account.

It is easier to gain root access permanently, for these other flavors of Linux click here to learn how.

If you’ve forgot your root password and need to reset it, Make Magazine has a nice writeup here:

HOWTO – reset a lost Ubuntu password