Home Blog Page 3

cPanel AWStats is Not Updating Automatically

0

AWStats is one of the most commonly using cPanel tool to analyse website traffic summary. You can analyse a lot of things from here like Number of visits, Pages, Hits, Bandwidth etc. In some strange situations, you may get this problem with AWStats, it’s not updating automatically. There are a lot of reasons behind this problem including file permission. Here I’m listing some points to check if you got this problem with AWStats.

How to access AWStats?

You can simply access and analyse this from the cPanel itself. Please do follow the steps:

1, Log into cPanel.
2, Move to;

Logs >> AWStats

That’s it.

How to update AWStats manually?

Yes, if it’s not updating automatically then you can update it manually. You can done this from the cPanel and also from the command line. You must have root access to server for updating AWStats via SSH. Here is the script;

1, SSH to server as root.
2, Execute;

/scripts/runweblogs $user-name

In the AWStats page there is an option to update it manually.

Why AWStats is not updating automatically?

There are a lot of reasons behind this. You have to check the following this via shell as root user.

1, SSH to server as root.
2, Change the directory to:

/home/user/tmp/awstats

There are the conf files for domains under that particular cPanel account. We need to make sure that the directive “AllowToUpdateStatsFromBrowser” is set to 1.

grep AllowToUpdateStatsFromBrowser awstats.example.com.conf

Example:

[email protected] [/home/****/tmp/awstats]# grep AllowToUpdateStatsFromBrowser awstats.servernoobs.com.conf
# Warning: If you want to be able to use the "AllowToUpdateStatsFromBrowser"
AllowToUpdateStatsFromBrowser=1

Also please check the permission of “/usr/local/cpanel/3rdparty/bin/awstats.pl” file. It must be 775.

# ll /usr/local/cpanel/3rdparty/bin/awstats.pl
-rwxrwxr-x. 1 root root 679172 Aug 23  2009 /usr/local/cpanel/3rdparty/bin/awstats.pl*

You can find more option from the WHM panel;

Home » Server Configuration » Statistics Software Configuration

Originally posted 2016-02-07 20:25:11.

How to install System Integrity Monitor (SIM) Cpanel

Description:
SIM is a system and services monitor for ‘SysVinit’ systems. It is designed to be intuitive and modular in nature, and to provide a clean and informative status system. It does this by consistently verifying that services are online, load averages are in check, and log files are at reasonable sizes. Many other SIM modules sport different and in-depth features to bring a well rounded tool to your disposal to stop otherwise common issues daunting internet hosts.

Features:
– Service monitoring of HTTP, FTP, DNS, SSH, MYSQL & more
– Event tracking and alert system
– Auto restart ability for downed services
– Checks against network sockets & process list to ensure services are online
– Advanced HTTP service monitoring, to prevent commonly encountered issues
– System load monitor with customizable warnings & actions
– Ability to auto restart system with definable critical load level
– Priority change configurable for services, at warning or critical load level
– Informative command line status display
– Easily customizable configuration file
– Auto configuration script
– Auto cronjob setup feature
– Simple & Informative installation script
– Integrated auto-update feature

Installation :

Download the tar file:
wget http://www.rfxn.com/downloads/sim-current.tar.gz
It will show below output:
wget http://www.rfxn.com/downloads/sim-current.tar.gz
--2013-12-20 15:02:31-- http://www.rfxn.com/downloads/sim-current.tar.gz
Resolving www.rfxn.com... 129.121.132.46
Connecting to www.rfxn.com|129.121.132.46|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 27250 (27K) [application/x-gzip]
Saving to: “sim-current.tar.gz”
100%[======================================>] 27,250 --.-K/s in 0.09s
2013-12-20 15:02:31 (281 KB/s) - “sim-current.tar.gz” saved [27250/27250]

Untar the file:
tar -xvf sim-current.tar.gz

Go to that folder:
cd sim-3.0

Run the below command to proceed with the installation:
  ./setup -i

Once the installation is complete it will show below output.
Installation Summary:
Base path: /usr/local/sim
Configuration file: /usr/local/sim/config/conf.sim
Configuration symlink: /etc/conf.sim
Module control file: /usr/local/sim/config/mods.control
Module control symlink: /etc/sim.mods
Executable: /usr/local/sim/sim
Executable symlink: /usr/local/sbin/sim
[email protected] [/usr/local/src/sim-3.0]#

Enable the cronjob:
/usr/local/sbin/sim -j

To receive email notification you have to edit /etc/conf.sim file.

Originally posted 2016-02-06 20:09:05.

CVE-2014-6271 – Critical BASH vulnerability discovered (Shellshock)

0

Critical BASH vulnerability discovered – update BASH on your CentOS Linux server!!!

## Shellshock vulnerability ##

Summary

>> A critical code execution vulnerability (Remote) affecting bash (Unix shell) has been discovered on September 24, 2014.
>> The vulnerability occurs because bash does not stop after processing the function definition; it continues to parse and execute shell commands following the function definition.
>> You can fix this by updating “BASH” to its latest version by using YUM.

More about the technical details.

It’s really a critical vulnerability for the CentOS bash which allows remote execution. This BASH vulnerability is resolved in the latest version of BASH “bash-4.1.2-15.el6_5.1″, it’s a prompt fix by the CentOS team.

Normally BASH support exporting variables and also functions to other bash instances via the same process environment to the child processes (indirect).

“Current bash versions use an environment variable named by the function name, and a function definition starting with “() {” in the variable value to propagate function definitions through the environment. The vulnerability occurs because bash does not stop after processing the function definition; it continues to parse and execute shell commands following the function definition.

For example, an environment variable setting of

VAR=() { ignored; }; /bin/id

will execute /bin/id when the environment is imported into the bash process. (The process is in a slightly undefined state at this point. The PATH variable may not have been set up yet, and bash could crash after executing /bin/id, but the damage has already happened at this point.)”

How to check this on your CentOS server?

Yes, you can simply find out whether your CentOS’s bash is vulnerable or not. Please do follow the steps pasted below:

1, SSH to server as root.
2, Execute the following command:

env x='() { :;}; echo vulnerable' bash -c "echo this is a test"

If your server is vulnerable, it will display the following:

[[email protected] ~]# env x='() { :;}; echo vulnerable' bash -c "echo this is a test"
vulnerable
this is a test

Solution

If you obtain this message, then please follow the steps given below:

yum clean all && yum update bash

Then check the version of BASH:

[[email protected] ~]# rpm -qa | grep bash
bash-4.1.2-15.el6_5.1.x86_64

Now execute the following command to check if it is fixed:

[[email protected] ~]# env x='() { :;}; echo vulnerable' bash -c "echo this is a test"
bash: warning: x: ignoring function definition attempt
bash: error importing function definition for `x'
this is a test

Originally posted 2016-02-05 19:50:08.

Running PPTP VPN with CSF firewall

0

Most of the time pptp vpn doesnt work with csf firewall. Here is the guide to make it working.

1) type the following command:
nano /etc/csf/csfpre.sh
2) Put the following into the file:
iptables -A INPUT -i venet0 -p tcp --dport 1723 -j ACCEPT
iptables -A INPUT -i venet0 -p gre -j ACCEPT
iptables -A OUTPUT -p gre -j ACCEPT
#iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -t nat -A POSTROUTING -s 10.84.1.0/24 -j SNAT --to-source ww.xx.yy.zz
iptables -A FORWARD -i ppp+ -o venet0 -j ACCEPT
iptables -A FORWARD -i venet0 -o ppp+ -j ACCEPT
Note: ww.xxy… is your VPS/server ip , 10.84.1.0/24 is the ip you allocated to the pptp

3) Type:
nano /etc/csf/csfpost.sh
4) Put the following there:
service pptpd stop
service pptpd start

Restart your VPS , connect to it and enjoy. Also make sure your 1723 port is open in Csf

Originally posted 2016-02-04 19:40:27.

CentOS Linux install and configure NTP to synchronize the system clock

Q. How do I install and configure NTP under CentOS Linux 5 server to synchronize the system clock?

A. You can easily install NTP (Network Time Protocol, a means of transmitting time signals over a computer network) using yum command under Redhat or CentOS/Fedora core Linux.

Procedure

Login as the root user

Type the following command to install ntp
# yum install ntp
Turn on service
# chkconfig ntpd on
Synchronize the system clock with 0.pool.ntp.org server:
# ntpdate pool.ntp.org
Start the NTP:
# /etc/init.d/ntpd start

Originally posted 2016-02-03 19:31:24.

cPanel: Apache + PHP FastCGI Data Timeout Error

If you are run on cPanel server and have FastCGI enabled in Apache, you might facing following error which caused your website hang or prompting ’500 Internal Server Error’ message. When checking into/etc/httpd/log/error_log, you will see something similar as below:

[warn] .. mod_fcgid: read data timeout in 40 seconds, ...
[error] .. Premature end of script headers: index.php ...

This is because mod_fcgid has reached the timeout in processing the parse data. So we need to increase some of the respective value:

1. Login to WHM > Apache Configuration > Include Editor > Post VirtualHost Include > All

2. Copy and paste following code:

<IfModule mod_fcgid.c>
 FcgidProcessLifeTime 8200
 FcgidIOTimeout 8200
 FcgidConnectTimeout 400
 FcgidMaxRequestLen 1000000000
 </IfModule>

3. You will need to restart Apache after that. Your FastCGI timeout will be changed to 400 seconds. For more information, please refer to Apache mod_fcgid directive at http://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html.

Originally posted 2016-02-02 19:22:45.

CentOS and RHEL 7 Restart, Stop, Start Networking Commands

1

I recently installed CentOS Linux version 7 or Red Hat Enterprise Linux version 7. How can I restart networking service using command line options? How can I start / stop and restart networking service on a CentOS/RHEL 7 based system?

CentOS 7 / RHEL 7 / Fedora Linux (many other modern distor) uses Systemd. It is a system and service manager for Linux operating systems. In newer distro such as CentOS7/RHEL7 systemd replaces Upstart as the default init system.

In older versions of CentOS or Red Hat Enterprise Linux, you used init scripts located in the /etc/rc.d/init.d/ directory. These init scripts were typically written in Bash, and allowed the system administrator to control the state of services and daemons in their system. In CentOS/RHEL 7, these init scripts have been replaced with service units.

CentOS 7 / RHEL 7 networking service name

To bring up/down networking service you need to use the network.service.

Say hello to systemctl command

Use this command to control the systemd system and act as a service manager.

CentOS 7 / RHEL 7 get status of network service

sudo systemctl status network.service

OR

sudo systemctl status network

CentOS 7 / RHEL 7 restart network service

sudo systemctl restart network.service

OR

sudo systemctl restart network

CentOS 7 / RHEL 7 start network service

sudo systemctl start network.service

OR

sudo systemctl start network

CentOS 7 / RHEL 7 stop network service

sudo systemctl stop network.service

OR

sudo systemctl stop network

A note about old service and chkconfig command

The service and chkconfig commands are still available in the system and work as expected, but are only included for compatibility reasons and should be avoided as may be dropped in future release.

Originally posted 2016-01-30 18:29:28.

UNIX Date Command Examples

1

How do I view and set date under UNIX operating systems?

The date command under UNIX display date. It is also used to set date and time. You must be the super-user (root) to change the date and time.

UNIX Date Command Syntax

date
date "+format"

Task: Display Current Date and Time

Type the following command:

date

Sample outputs:

Tue Oct 27 15:35:08 CDT 2009

Task: Set The Current Time

To set the current time to 05:30:30, enter:

date 0530.30

Task: Set Date

Set the date to Oct 25, 12:45 a.m., enter:

date 10250045

Another example – set the current date and time to Oct 15, 2009 04:30 you type:

date --set="20091015 04:30"

Task: Generating Output

WARNING! These examples may not work on Linux computer i.e. GNU coreutiles date command. All examples are tested on HP-UX, AIX, Sun Solaris and other propitiatory UNIXoperating systems only.
Type the following command:

date '+DATE: %m/%d/%y%nTIME:%H:%M:%S'

Sample outputs:

DATE: 10/27/09
TIME:15:50:44

Try the following examples:

date "+%m/%d/%y"
date "+%Y%m%d"
date +'%-4.4h %2.1d %H:%M'

Unix Command Help

Type the following command to read the date command man page:

man date

Originally posted 2016-01-29 18:26:20.

Display Hard Disk Specs and Details on Linux

0

Linux comes with various commands to find out information about your hard drive. I recommend hdparm command which provides a command line interface to various hard disk ioctls supported by the stock Linux ATA/IDE device driver subsystem. This command read / request identification information such as disk size, description and much more directly from the drive, which is displayed in a new expanded format.

hdparm Command

Open the terminal and type the following command to find information about /dev/sda:
# hdparm -I /dev/sda
OR
$ sudo hdparm -I /dev/sda
Sample outputs:

/dev/sda:

ATA device, with non-removable media
 Model Number: HGST HUS724020ALA640
 Serial Number: PN2134P6JLWNBP
 Firmware Revision: MF6OAA70
 Transport: Serial, ATA8-AST, SATA 1.0a, SATA II Extensions, SATA Rev 2.5, SATA Rev 2.6, SATA Rev 3.0; Revision: ATA8-AST T13 Project D1697 Revi
sion 0b
Standards:
 Used: unknown (minor revision code 0x0029)
 Supported: 8 7 6 5
 Likely used: 8
Configuration:
 Logical max current
 cylinders 16383 16383
 heads 16 16
 sectors/track 63 63
 --
 CHS current addressable sectors: 16514064
 LBA user addressable sectors: 268435455
 LBA48 user addressable sectors: 3907029168
 Logical Sector size: 512 bytes
 Physical Sector size: 512 bytes
 device size with M = 1024*1024: 1907729 MBytes
 device size with M = 1000*1000: 2000398 MBytes (2000 GB)
 cache/buffer size = unknown
 Form Factor: 3.5 inch
 Nominal Media Rotation Rate: 7200
Capabilities:
 LBA, IORDY(can be disabled)
 Queue depth: 32
 Standby timer values: spec'd by Standard, no device specific minimum
 R/W multiple sector transfer: Max = 16 Current = 16
 Advanced power management level: disabled
 DMA: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 udma5 *udma6
 Cycle time: min=120ns recommended=120ns
 PIO: pio0 pio1 pio2 pio3 pio4
 Cycle time: no flow control=120ns IORDY flow control=120ns
Commands/features:
 Enabled Supported:
 * SMART feature set
 Security Mode feature set
 * Power Management feature set
 * Write cache
 * Look-ahead
 * Host Protected Area feature set
 * WRITE_BUFFER command
 * READ_BUFFER command
 * NOP cmd
 * DOWNLOAD_MICROCODE
 Advanced Power Management feature set
 Power-Up In Standby feature set
 * SET_FEATURES required to spinup after power up
 SET_MAX security extension
 * 48-bit Address feature set
 * Device Configuration Overlay feature set
 * Mandatory FLUSH_CACHE
 * FLUSH_CACHE_EXT
 * SMART error logging
 * SMART self-test
 Media Card Pass-Through
 * General Purpose Logging feature set
 * WRITE_{DMA|MULTIPLE}_FUA_EXT
 * 64-bit World wide name
 * URG for READ_STREAM[_DMA]_EXT
 * URG for WRITE_STREAM[_DMA]_EXT
 * WRITE_UNCORRECTABLE_EXT command
 * {READ,WRITE}_DMA_EXT_GPL commands
 * Segmented DOWNLOAD_MICROCODE
 * unknown 119[7]
 * Gen1 signaling speed (1.5Gb/s)
 * Gen2 signaling speed (3.0Gb/s)
 * Gen3 signaling speed (6.0Gb/s)
 * Native Command Queueing (NCQ)
 * Host-initiated interface power management
 * Phy event counters
 * NCQ priority information
 Non-Zero buffer offsets in DMA Setup FIS
 * DMA Setup Auto-Activate optimization
 Device-initiated interface power management
 In-order data delivery
 * Software settings preservation
 * SMART Command Transport (SCT) feature set
 * SCT Write Same (AC2)
 * SCT Error Recovery Control (AC3)
 * SCT Features Control (AC4)
 * SCT Data Tables (AC5)
Security:
 Master password revision code = 65534
 supported
 not enabled
 not locked
 frozen
 not expired: security count
 not supported: enhanced erase
 444min for SECURITY ERASE UNIT.
Logical Unit WWN Device Identifier: 5000cca22de4c582
 NAA : 5
 IEEE OUI : 000cca
 Unique ID : 22de4c582
Checksum: correct

lshw Command

You need to install lshw command using apt-get or yum command. To display all disks and storage controllers in the system, enter:
# lshw -class disk -class storage
Sample outputs:

   *-storage
 description: SATA controller
 product: 8 Series/C220 Series Chipset Family 6-port SATA Controller 1 [AH
CI mode]
 vendor: Intel Corporation
 physical id: 1f.2
 bus info: [email protected]:00:1f.2
 logical name: scsi0
 logical name: scsi1
 version: 05
 width: 32 bits
 clock: 66MHz
 capabilities: storage msi pm ahci_1.0 bus_master cap_list emulated
 configuration: driver=ahci latency=0
 resources: irq:34 ioport:f0b0(size=8) ioport:f0a0(size=4) ioport:f090(siz
e=8) ioport:f080(size=4) ioport:f060(size=32) memory:f7d12000-f7d127ff
 *-disk:0
 description: ATA Disk
 product: HGST HUS724020AL
 physical id: 0
 bus info: [email protected]:0.0.0
 logical name: /dev/sda
 version: MF6O
 serial: PN2134P6JLWNBP
 size: 1863GiB (2TB)
 capabilities: partitioned partitioned:dos
 configuration: ansiversion=5 signature=00077b8e
 *-disk:1
 description: ATA Disk
 product: HGST HUS724020AL
 physical id: 1
 bus info: [email protected]:0.0.0
 logical name: /dev/sdb
 version: MF6O
 serial: PN2134P6JRXJ5X
 size: 1863GiB (2TB)
 capabilities: partitioned partitioned:dos
 configuration: ansiversion=5 signature=000c8e4f

Find Out Disks Name Only

The following command will quickly list installed disks including CD/DVD/BD drivers:
# lshw -short -C disk
Sample outputs:

H/W path Device Class Description
======================================================
/0/100/1f.2/0 /dev/sda disk 2TB HGST HUS724020AL
/0/100/1f.2/1 /dev/sdb disk 2TB HGST HUS724020AL

Originally posted 2016-01-27 18:16:47.

HowTo Run a Script In Linux

How do I run a Linux shell script? How can I run a script in Linux?

By default script will not run. You need to set execute permission for your script. To execute or run script type the following command:
chmod +x script-name-here
OR
chmod 0755 script.sh
Use the ls command to view permission on the script:
$ ls -l script-name-here
To execute the script, type:
$ ./script-name-here
You can also run a script using any one of the following syntax:
$ /path/to/shell/script/backup.sh
Run a script called backup.ksh using ksh shell:
$ ksh backup.ksh
Run a script called backup.bash using BASH shell:
$ bash backup.bash

Example

Create a shell script called hello.sh using a text editor:

 
#!/bin/bash
echo "Hello $USER."
echo "Today is $(date)"
echo "Current working directory : $(pwd)"

Save and close the file. Set the permission:
$ chmod +x hello.sh
$ ./hello.sh

If the current directory is in the PATH variable, you can avoid typing the ./ before the hello.sh. It is a good idea to create your own bin directory as follows:
$ mkdir $HOME/bin
Add $HOME/bin to the PATH variable using bash shell export command:
$ export PATH=$PATH:$HOME/bin
$ echo $PATH

Move hello.sh in $HOME/bin using the mv command:
$ mv hello.sh $HOME/bin
Execute the script:
$ hello.sh
Sample outputs:

Hello vivek.
Today is Thu Nov 10 17:49:15 IST 2011
Current working directory : /nafiler05/users/v/vivek/bin/demos

Originally posted 2016-01-26 17:59:07.