Saturday, 13 September 2014

vi Find And Replace Text Command


How do I find and replace (substitute) test using vi or vim text editor under UNIX / Linux / BSD or Apple OS X operating systems?


Both vi and vim text editor comes with substitute command for finding and replacing text.


Syntax


The syntax is as follows:
:%s/WORD-To-Find-HERE/Replace-Word-Here/g
OR
:%s/FindMe/ReplaceME/g


Examples


The substitute command can be used as per your requirements.


Task: VI / Vim Basic Find and Replace


To find each occurrence of 'UNIX', and replace it with 'Linux', enter (press ESC, type : and following command):
:%s/UNIX/Linux/g


Task: Find and Replace with Confirmation


Find a word called 'UNIX' and replace with 'Linux', but ask for confirmation first, enter:
:%s/UNIX/Linux/gc


Task: Find and Replace Whole Word Only


Find whole words exactly matching 'UNIX' to 'Linux'; and ask for confirmation too:
:%s/<UNIX>/Linux/gc


Task: Case Insensitive Find and Replace


Find 'UNIX' (match UNIX, unix, UnIx, Unix and so on) and replace with 'Linux':
:%s/unix/Linux/gi
Same command with confirmation:
:%s/unix/Linux/gic


Task: Case sensitive Find and Replace


Find each 'UNIX' and replace with 'bar':
:%s/UNIX/bar/gI
Same command with confirmation:
:%s/UNIX/bar/gIc


How Do I Replace In the Current Line Only?


Find 'UNIX' and replace with 'Linux' in the current line only (note % is removed from substitute command):
:s/UNIX/Linux/g
NOTE: You need to prefix % the substitute command to make changes on all lines:
:%s/UNIX/Linux/g


How Do I Replace All Lines Between line 100 and line 250?


:{START-n},{END-n}s/word1/word2/g
Find 'UNIX' and replace with 'Linux' all lines between line 100 and line 250, enter:
:100,200s/UNIX/Linux/g
OR
:100,200s/UNIX/Linux/gc

ffmpeg installer

Enabling mbstring Library in PHP.ini

cPanel to cPanel migration via SSH - Multiple domains

Know more about localdomains and remotedomains

Services for one domain do not need to be on one server. The site host and email server for a domain do not need to be on the same physical server.


DNS is used to direct the traffic to the correct place, but DNS alone will not get all the bits to where they are supposed to be. Exim, cPanel’s SMTP service needs a little help beyond DNS in order to know how to handle mail that is generated locally.


This is where /etc/localdomains and /etc/remotedomains come into play.





  • How do it works




Email sent out from a cPanel server, exim has to checks /etc/localdomains and /etc/remotedomains in order to send the email to the correct location.


If the domain is in /etc/localdomains, the mail is routed locally to the machine. If the domain is in /etc/remotedomains, the email is routed out to the Internet.


This is useful if the domain has some software installed that sends email notifications, such as a content management system like WordPress. This ensures that mail will get sent to the correct location.


If domain uses a third party mail server for email and the domain is not in remotedomains, notifcations from the CMS will not be delivered.





  • Setting email option during account creation




At the bottom of the account creation page in the Webhost Manager.


If Local Mail Exchanger is set, cPanel places the domain in localdomains. If Remote Mail Exchanger is selected, it places the domain in remotedomains. If Backup Mail Exchanger is selected, the domain will be added to localdomains but will only accept mail if there are no other mail servers available.


Automatically Detect Configuration will check the DNS Mail Exchanger records to see where the DNS is pointed, and make the configuration based off of that. Most of the time, this is the best option to select. However, if DNS has not been setup for the domain yet, you may wish to set the Exchanger manually.


Automatically Detect Configuration will check the DNS Mail Exchanger records to see where the DNS is pointed, and make the configuration based off of that. Most of the time, this is the best option to select. However, if DNS has not been setup for the domain yet, you may wish to set the Exchanger manually.



How to modify my hosts file?

Modifying your hosts file will allow you to override the DNS for a domain, on that particular machine. This can be used to test your site without the test link, prior to going live with SSL, verify an alias site works prior to DNS changes, or for other DNS related reasons. This causes your local machine only to look directly at the IP specified.


Your hosts file will need to have two entries added that will contain the IP address you want the site to resolve to and the address. Adding the below two lines for example will point www.domain.com and domain.com to our current PHP5-ITK ("Refreshed" PHP5) cluster:


1.2.3.4 www.domain.com
1.2.3.4 domain.com


Below is how to locate and edit the hosts file on several OS platforms. Once the proper domain information is added you will save the file and your system will begin resolving to the specified IP. Once testing is finished these entries should be removed.


Contents:-   
Windows Vista and Windows 7
Windows NT/2000/XP
Linux
Mac OSX 10.0 - 10.1.5
Mac OSX 10.6 - 10.8


 


 

Mail queue alert script for cPanel server via email

We need to monitor our server mail queue for cPanel servers, Possible outgoing spam as well as to maintain the server performance. Often large mail queue causes server overloading issues. It is very easy to get an alert if your server mail queue contains more than X  numbers of mails. You can use the following script to monitor your server mail queue for your cPanel servers:




#!/bin/bash
# use: Bash Shell script to monitor or Check Mail queue


EMAIL=”your email address”

MQUEUE=`find /var/spool/exim/input -name ‘*-H’ | wc -l | sed -e “s/ //g”`

if [ $MQUEUE -gt XXX ]; then
echo “Mail queue at `hostname` has $MQUEUE messages!!!” | mail -s “MAIL QUEUE ALERT: Mail queue for `hostname`” $EMAIL
fi

Better WP Security

Easiest and most effective way to secure your WordPress to Improve security of any your wordpress site's in minutes.


#1 WORDPRESS SECURITY PLUGIN


Better WP Security now by iThemes


Get ready for Better WP Security to get even better! It's now being maintained and developed full-time by Chris Wiegman for iThemes. Not only will this take Better WP Security to the next level but it will bring a new level of security to the best ecommerce solution on the market, iThemes Exchange as well as all of iThemes excellent plugins and themes.


Better WP Security takes the best WordPress security features and techniques and combines them in a single plugin thereby ensuring that as many security holes as possible are patched without having to worry about conflicting features or the possibility of missing anything on your site.


With one-click activation for most features as well as advanced features for experienced users Better WP Security can help protect any site.


Professional Installation and Support Now Available


Need help or want to make sure your setup is as secure as possible? Professional support is now available! Purchase support or installation today through our partner FooPlugins


Obscure


As most WordPress attacks are a result of plugin vulnerabilities, weak passwords, and obsolete software. Better WP Security will hide the places those vulnerabilities live keeping an attacker from learning too much about your site and keeping them away from sensitive areas like login, admin, etc.



  • Remove the meta "Generator" tag

  • Change the urls for WordPress dashboard including login, admin, and more

  • Completely turn off the ability to login for a given time period (away mode)

  • Remove theme, plugin, and core update notifications from users who do not have permission to update them

  • Remove Windows Live Write header information

  • Remove RSD header information

  • Rename "admin" account

  • Change the ID on the user with ID 1

  • Change the WordPress database table prefix

  • Change wp-content path

  • Removes login error messages

  • Display a random version number to non administrative users anywhere version is used


Protect


Just hiding parts of your site is helpful but won't stop everything. After we hide sensitive areas of the sites we'll protect it by blocking users that shouldn't be there and increasing the security of passwords and other vital information.



  • Scan your site to instantly tell where vulnerabilities are and fix them in seconds

  • Ban troublesome bots and other hosts

  • Ban troublesome user agents

  • Prevent brute force attacks by banning hosts and users with too many invalid login attempts

  • Strengthen server security

  • Enforce strong passwords for all accounts of a configurable minimum role

  • Force SSL for admin pages (on supporting servers)

  • Force SSL for any page or post (on supporting servers)

  • Turn off file editing from within WordPress admin area

  • Detect and block numerous attacks to your filesystem and database


Detect


Should all the protection fail Better WP Security will still monitor your site and report attempts to scan it (automatically blocking suspicious users) as well as any changes to the filesystem that might indicate a compromise.



  • Detect bots and other attempts to search for vulnerabilities

  • Monitor filesystem for unauthorized changes


Recover


Finally, should the worst happen Better WP Security will make regular backups of your WordPress database (should you choose to do so) allowing you to get back online quickly in the event someone should compromise your site.



  • Create and email database backups on a customizable schedule


Other Benefits



  • Make it easier for users to log into a site by giving them login and admin URLs that make more sense to someone not accustomed to WordPress

  • Detect hidden 404 errors on your site that can affect your SEO such as bad links, missing images, etc.


Compatibility



  • Works on multi-site (network) and single site installations

  • Works with Apache, LiteSpeed or NGINX (NGINX will require you to manually edit your virtual host configuration)

  • Some features can be problematic if you don't have enough RAM to support them. All my testing servers allocate 128MB to WordPress and usually don't have any other plugins installed. I have seen issues with file check and database backups failing on servers with 64MB or less of RAM, particularly if there are many other plugins being used.


Translations



  • Brazilian Portuguese by Rafael Funchal

  • Bulgarian by Nikolay Kolev of Gymnastics and Bodyweight Tutorials and Martin Halachev

  • Chinese (Traditional) by Toine Cheung

  • French by SCUDELLER Eric

  • German by Rene Wolf

  • Hindi by Outshine Solutions

  • Lithuanian by Vincent G

  • Persian by Ibrahim Jafari

  • Russian

  • Simplified Chinese by ??

  • Slovak by Erich Szabó

  • Spanish by Pablo Romero

  • Tagalog by Hanne

  • Turkish by Hakan Er


Please let us know if you would like to contribute a translation.


Warning


Please read the installation instructions and FAQ before installing this plugin. It makes some significant changes to your database and other site files which, without a proper backup, can cause problems if something goes wrong. While problems are rare, most (not all) support requests I get for this plugin involve the users failure to make a proper backup before installing.


Setup a CentOS IPSEC VPN Server

Install the Nikoforge Repository


rpm -ivH http://repo.nikoforge.org/redhat/el6/nikoforge-release-latest


Install EPEL Repo


yum -y install http://vesta.informatik.rwth-aachen.de/ftp/pub/Linux/fedora-epel/6/i386/epel-release-6-8.noarch.rpm


Install IPSEC Tools


yum -y install ipsec-tools


The ipsec-tools package from the nikoforge repo is a patched version that allow the use of a wildcard ‘’ as the IPSec identifier [1]. Not needed for Android, but iOS.*


Install Layer 2 Tunneling Protocol Daemon


yum -y install xl2tpd


Create script ”/etc/racoon/init.sh”


Insert the following:


    #!/bin/sh
# set security policies
echo -e “flush;n
spdflush;n
spdadd 0.0.0.0/0[0] 0.0.0.0/0[1701] udp -P in ipsec esp/transport//require;n
spdadd 0.0.0.0/0[1701] 0.0.0.0/0[0] udp -P out ipsec esp/transport//require;n”
| setkey -c
# enable IP forwarding
echo 1 > /proc/sys/net/ipv4/ip_forward


Then set the correct permissions


chmod 750 /etc/racoon/init.sh


Add a call of the script to rc.local


sed –in-place ‘//etc/racoon/init.sh/d’ /etc/rc.d/rc.local
echo /etc/racoon/init.sh >> /etc/rc.d/rc.local


IPSEC CONFIGURATION


Racoon Config ”/etc/racoon/racoon.conf” (If there is one already there, bcack it up to .old)


path include “/etc/racoon”;
path pre_shared_key “/etc/racoon/psk.txt”;
path certificate “/etc/racoon/certs”;
path script “/etc/racoon/scripts”;
remote anonymous
{
exchange_mode aggressive,main;
passive on;
proposal_check obey;
support_proxy on;
nat_traversal on;
ike_frag on;
dpd_delay 20;
proposal
{
encryption_algorithm aes;
hash_algorithm sha1;
authentication_method pre_shared_key;
dh_group modp1024;
}
proposal
{
encryption_algorithm 3des;
hash_algorithm sha1;
authentication_method pre_shared_key;
dh_group modp1024;
}
}
sainfo anonymous
{
encryption_algorithm aes,3des;
authentication_algorithm hmac_sha1;
compression_algorithm deflate;
pfs_group modp1024;
}


Set the relevant permissions


chmod 600 /etc/racoon/racoon.conf


Racoon Pre shared Keys


Create the pre-shared keys file for IKE authentication. The 1st column the IPSec Identifier, the 2nd column is the IPSec preshared key.


”/etc/racoon/psk.txt”


ANDROID


myhomelan d41d8cd98f00b204e980


IOS



* d41d8cd98f00b204e980




Set the correct permissions



chmod 600 /etc/racoon/psk.txt



CONFIGURING L2TP DAEMON


Create file ”/etc/xl2tpd/xl2tpd.conf




[global]
ipsec saref = yes
force userspace = yes
[lns default]
local ip = 10.203.123.200
ip range = 10.203.123.201-10.203.123.210
refuse pap = yes
require authentication = yes
ppp debug = yes
length bit = yes
pppoptfile = /etc/ppp/options.xl2tpd



CONFIGURING PPP


Create PPP option file ”/etc/ppp/options.xl2tpd



    ms-dns 10.203.120.41
ms-dns 8.8.8.8
require-mschap-v2
asyncmap 0
auth
crtscts
lock
hide-password
modem
debug
name l2tpd
proxyarp
lcp-echo-interval 10
lcp-echo-failure 100



Create the CHAP Secrets file ”/etc/ppp/chap-secrets”



    # client server secret IP addresses
janedoe * jd480227 *



Set the Correct permissions


 


chmod 600 /etc/ppp/chap-secrets


START THE SERVICES


    chkconfig racoon on
chkconfig xl2tpd on
service racoon start
service xl2tpd start
/etc/racoon/init.sh


ANDROID CLIENT SETUP


    NAME – ANYTHING
TYPE – L2TP/IPSec PSK
SERVER ADDRESS – IP or hostname of server
L2TP SECRET – NOT USED
IPSec IDENTIFIER – what was set in first colum of racoon psk file
PRE-SHARED KEY – What was in the second column of racoon psk file


For my VPS to pass traffic through i had to execute the following


iptables –table nat –append POSTROUTING –jump MASQUERADE


echo “net.ipv4.ip_forward = 1? | tee -a /etc/sysctl.conf
echo “net.ipv4.conf.all.accept_redirects = 0? | tee -a /etc/sysctl.conf
echo “net.ipv4.conf.all.send_redirects = 0? | tee -a /etc/sysctl.conf
for vpn in /proc/sys/net/ipv4/conf/*; do echo 0 > $vpn/accept_redirects; echo 0 > $vpn/send_redirects; done
sysctl -p


for vpn in /proc/sys/net/ipv4/conf/*; do echo 0 > $vpn/accept_redirects; echo 0 > $vpn/send_redirects; done
iptables –table nat –append POSTROUTING –jump MASQUERADE


 

What is PHP Composer?

If you have ever written anything in PHP before, you have probably found that it feels like you have to keep re-inventing the wheel anytime you want to do a common task such as User Authentication, Database Management or Request Routing. PHP now has a handful of mature frameworks that have already solved all of these problems, so wouldn’t it be easier to cherry pick the bits that you needed from each framework?


If you were to start manually picking the bits you wanted from Zend, or Laravel or Symfony, then it would become very difficult to manage. Each library might also have dependencies, and so you would end up in a mess, particularly if you required other people to work on your project.


This is where Composer comes in. Composer is a dependency manager for PHP. Composer will manage the dependencies you require on a project by project basis. This means that Composer will pull in all the required libraries, dependencies and manage them all in one place.


This kind of management for dependencies in a project is not a new concept, and in fact, much of Composer is actually inspired from npm from Node.js and Bundler from Ruby.


You might also be aware of PEAR. PEAR is an established PHP package manager that has been around for years. PEAR however, has been abandoned by many PHP developers for a number of reasons. Firstly, much of the code in PEAR is out-of-date. Secondly, PEAR forces you to install packages system wide, rather than on a project-by-project basis. This means that if you already have a project that relies on a slightly older package, you are screwed. For an excellent history of PHP packages, read Packages: The Way Forward for PHP by Phil Sturgeon.


Installing Composer


Installing Composer is really easy as it can all be done through the command line. I’m using OS X, but the following should be the same for any *nix operating system.


So fire up Terminal and run the following commands:


$ curl -s https://getcomposer.org/installer | php
$ sudo mv composer.phar /usr/local/bin/composer


The first command downloads the composer.phar file to your computer. The second line moves the composer.phar file in to your bin so that is accessible globally on your computer.


Now run the following command:


$ composer


If you have installed Composer successfully, you should be given a list of available commands and descriptions.
Installing on Windows?


If you are looking to install Composer on a Windows machine, take a look at the guide on the Composer website.
Using Composer


Now that you have Composer installed, you can use it to require some packages into your project. To make a Composer configuration file, we just need to make a JSON file in the root of the project.


For example, if you wanted to use Slim Framework you could create the following composer.json file.


{
"require": {
"slim/slim": "2.*"
}
}


To install Slim via Composer, you can simply run the following command through Terminal.


$ composer install


This will automatically download Slim into your project under the directory vendor/slim/slim.


See, how easy was that?
Autoloading


Now that you have all of these different packages, you need the ability to autoload them into your project. Fortunately Composer also comes with an autoload file, which is capable of autoloading any of the files in the projects that you download.


To use the Composer autoloader, simply include the following line in your project’s index or bootstrap file.


require 'vendor/autoload.php';


Now you can start using the new libraries without having to worry about loading them up.


For example:


// Autoload
require 'vendor/autoload.php';


// Instantiate a Slim application
$app = new SlimSlim();


// Define a HTTP GET route
$app->get('/hello/:name', function ($name) {
echo "Hello, $name";
});


// Run the Slim application
$app->run();
Conclusion


Package management is clearly the right route forward for PHP. Languages such as Ruby have shown how incredibly easy it is to use packages within projects so common problems can be solved once, and you can stop wasting time as a developer by constantly reinventing the wheel.


Many of the most popular frameworks have already positioned themselves to use Composer, and many more individual developers are releasing code that is Composer ready from the get go.


As a PHP developer, Composer will become your best friend, and as it’s usage increases, it will become an essential part of writing PHP on a day-to-day basis.


By following conventions, PHP can become a much better language to use. Composer has already solved a big problem in the PHP community, so there’s really no reason why you shouldn’t start using it today.

How to install htop

To install htop with yum, the EPEL repository must be installed.

Redhat / CentOS 5 (most likely version in use)


32bit: rpm -Uvh http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
64bit: rpm -Uvh http://download.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm

Redhat / CentOS 6


32bit: rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
64bit: rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

Now that the repository is installed to the server, we can install htop
yum install htop

 

Tuesday, 9 September 2014

Install NixTree PHP Selector in CloudLinux cPanel server

NixTree PHP Selector plugin allows a domain user to select preferred PHP version per directory on the same domain.
Note :This plugin requires SuPHP on the system; it will not work with any other PHP handlers for now.

To install ntPHPselector, run the following commands:

cd /usr/local/src
wget -N http://nixtree.com/download/free/ntphpselector_manage.sh
sh ntphpselector_manage.sh install


To recompile php in ntPHPselector, run the following command:

sh ntphpselector_manage.sh recompile <option>


– option
2 for 5.2
3 for 5.3
4 for 5.4
5 for 5.5

eg: recompile php5.2

sh ntphpselector_manage.sh recompile 2


For uninstalling the plugin:

sh ntphpselector_manage.sh uninstall

Tuesday, 19 August 2014

Block an Email in Plesk

Although Plesk has a built-in spam filter that blocks most spam messages from reaching your email account, some unwanted messages may slip past it unhindered. To rectify this issue, you must make use of the spam filter’s blacklist function to stop receiving messages from a particular email address in the future. In addition to blocking email addresses individually, you can also configure the Plesk spam filter to block all email addresses related to a particular domain.



1 ). Sign in to your Plesk Control Panel.



2). Click the “Mail” tab, and then select an email account from the list under “Email Address.”



3). Click the “Spam Filter” tab. If unchecked, check the box next to “Switch on Spam Filtering for This Email Address,” and then click the “Show Advanced Settings” option below.



4). Enter the email address that you want blocked into the vacant text box next to “Black List.” To block multiple email addresses, press “Enter” after inserting each address into the text box. To block all incoming email from addresses related to a particular domain, enter "*@domain_name.com” (without quotes), replacing "domain_name.com" with the name of the domain.



5). Click “OK” to save the changes.

Monday, 30 June 2014

How to Install htop

To install htop with yum, the EPEL repository must be installed.

Redhat / CentOS 5 (most likely version in use)



32bit: rpm -Uvh http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
64bit: rpm -Uvh http://download.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm


Redhat / CentOS 6



32bit: rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
64bit: rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm


Now that the repository is installed to the server, we can install htop

yum install htop


 

Thursday, 26 June 2014

How to Disable magic quotes Joomla on Linux Server

Error while accessing modsec control from WHM :Software error

Can’t locate JSON/XS.pm in @INC (@INC contains: /usr/local/cpanel /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/5.8.8 .) at /usr/local/cpanel/Cpanel/JSON.pm line 15.


You can disable magic quotes in joomla by adding the following line to the php.ini file.

magic_quotes_gpc = Off


If it did’t solver the issue you need to add the following lines to the php5.ini in the document-root.

magic_quotes_gpc = Off
magic_quotes_runtime = Off
magic_quotes_sybase = Off
extension=pdo.so
extension=pdo_mysql.so


If the file php5.ini is not there in the document root, then you can rename the php.ini as php.ini.

Also after adding this you need to add the following lines on the .htaccess file. If there is no .htaccess then you can create a new file and add the following codes to it,

SetEnv PHPRC /home/$username/public_html/

Note : Replace the path “/home/$username/public_html/” properly with your path.

Commands

Command to find the no of process running by each user

ps aux |awk '{$1} {++P[$1]} END {for(a in P) if (a !="USER") print a,P[a]}' | sort -k 2


Command to find total no of php process running be each user

ps aux | grep php  |awk '{$1} {++P[$1]} END {for(a in P) if (a !="USER") print a,P[a]}' | sort -n -k 2


Command to find total no of dovecot process running be each user

ps aux | grep dovecot  |awk '{$1} {++P[$1]} END {for(a in P) if (a !="USER") print a,P[a]}' | sort -n -k 2


Command to kill all the Dovecot process

ps -aux | grep dovecot | awk '{print $2}' | xargs kill -9


Find Plesk admin password from commandline

/usr/local/psa/bin/admin --show-password


Command to kill all process running on Port 80

ps -aux | grep dovecot | awk '{print $2}' | xargs kill -9

Wednesday, 25 June 2014

Update Clamav to Latest Version on cPanel Server

Recently received a clam update in logwatch and seen the duplicate database error and went in to take a look at what was going on.

--------------------- clam-update Begin ------------------------
The ClamAV update process was started 3 time(s)
Last ClamAV update process started at Fri May 18 01:44:12 2012
Last Status:
main.cvd is up to date (version: 54, sigs: 1044387, f-level: 60, builder: sven)
Downloading daily-14929.cdiff [100%]
Downloading daily-14930.cdiff [100%]
Downloading daily-14931.cdiff [100%]
daily.cld updated (version: 14931, sigs: 174042, f-level: 63, builder: guitar)
bytecode.cld is up to date (version: 178, sigs: 40, f-level: 63, builder: neo)
[LibClamAV] Detected duplicate databases /var/clamav/main.cvd and /var/clamav/main.cld, please manually remove one of them
Database updated (1218469 signatures) from db.us.clamav.net (IP: xxx.xxx.xxx.xx)
Clamd successfully notified about the update.
---------------------- clam-update End -------------------------



After I repaired that issue, (basically just removed “aka rm’d” the older /var/clamav/main.cvd database) and I came across a slightly less important issue which was clamav was reporting an old version from the command line.

[root@serverT.com]  freshclam
ClamAV update process started at Tue May 20 11:00:07 2014
WARNING: Your ClamAV installation is OUTDATED!
WARNING: Local version: 0.98.3 Recommended version: 0.98.4
DON'T PANIC! Read http://www.clamav.net/support/faq
main.cvd is up to date (version: 55, sigs: 2424225, f-level: 60, builder: neo)
daily.cld is up to date (version: 19005, sigs: 958471, f-level: 63, builder: neo)
bytecode.cld is up to date (version: 237, sigs: 44, f-level: 63, builder: dgoddard)



Well, I read the FAQ which was somewhat ambiguous and started looking for other options to update this apart from cpanel – WHM 11.44.0 (build 18)



I was able to locate this set of instructions from an older version of clamav which worked very well.

cd /usr/local/cpanel/modules-install/clamavconnector-Linux-x86_64


wget http://kaz.dl.sourceforge.net/project/clamav/clamav/0.98.4/clamav-0.98.4.tar.gz


vim the 'install' file


AVV=0.98.4


Find the line AVVOLD=0.97.1 and make it AVVOLD=0.98.3

AVVOLD=0.98.3
:wq


The values in those lines will depend upon the version of your ClamAV. Save the ‘install’ file after making the changes.

Then edit the file ‘progversion’ and put the latest version of ClamAV there. You can do this with a simple command.

echo "0.98.4" > progversion


then run

./install
freshclam

Sunday, 22 June 2014

Script to Change Password of all cPanel Accounts

Bash script to update password of all cPanel Accounts

#! /bin/bash
rm New-Password.txt
echo " " >> New-Password.txt
echo " " >> New-Password.txt
echo "======================================" >> New-Password.txt
echo "Thank you for using iServerSupport.com" >> New-Password.txt
echo "======================================" >> New-Password.txt
echo " " >> New-Password.txt
echo "Passwords of all your cPanel account has changed below are the new passwords" >> New-Password.txt
echo " " >> New-Password.txt
cat /etc/domainusers|awk -F: '{print $1}' | while read user; do
pass=`</dev/urandom tr -dc A-Za-z0-9 | head -c 20`
echo $user $pass >> New-Password.txt
/scripts/realchpass $user $pass > /dev/null
/scripts/ftpupdate > /dev/null
done
echo " " >> New-Password.txt
echo " " >> New-Password.txt
cat New-Password.txt


Create a file called change password.sh and copy above contents into it



vi changepassword.sh


Give execution permission for the file



chmod +x changepassword.sh


Run the script



sh  changepassword.sh


Friday, 20 June 2014

List installed perl modules

You can list installed perl modules using the below command


 


instmodsh

Available commands are:

l - List all installed modules

m <module> - Select a module

q - Quit the program

cmd? l



 


Installed modules are:





Acme::Spork
AppConfig
Archive::Tar
Archive::Tar::Streamed
Archive::Zip
Authen::Libwrap
BSD::Resource
Business::OnlinePayment
Business::OnlinePayment::AuthorizeNet
Business::UPS
CDB_File
CPAN
CPAN::DistnameInfo
CPAN::SQLite
Carp
Class::Accessor
Class::ErrorHandler
Class::Inner
Class::Inspector
Class::Load
Class::Singleton
Class::Std
Class::Std::Utils
Clone
Compress::Bzip2
Compress::Raw::Bzip2
Compress::Raw::Zlib
Convert::ASN1
Crypt::GPG
Crypt::OpenSSL::RSA
Crypt::OpenSSL::Random
Crypt::Passwd::XS
Crypt::PasswdMD5
Crypt::RC4
Crypt::SSLeay
Curses
Curses::UI
Cwd
DBD::SQLite2
DBD::mysql
DBI
DBIx::MyParsePP
Data::Dump
Data::Dumper
Data::MessagePack
Data::OptList
Date::Parse
DateTime
DateTime::Locale
DateTime::TimeZone
Devel::Symdump
Digest::HMAC
Digest::MD5
Digest::MD5::File
Digest::Perl::MD5
Digest::SHA
Digest::SHA1
Dist::CheckConflicts
Email::Address
Email::Date::Format
Email::MIME
Email::MIME::ContentType
Email::MIME::Encodings
Email::MessageID
Email::Simple
Email::Valid
Encode::Detect
Encode::Locale
Error
Expect
ExtUtils::CBuilder
ExtUtils::MakeMaker
File::Find::Rule
File::Find::Rule::Filesys::Virtual
File::HomeDir
File::Listing
File::MMagic::XS
File::NFSLock
File::Path::Tiny
File::Slurp
File::Tail
File::Temp
File::Touch
File::Which
Filesys::Df
Filesys::Statvfs
Filesys::Virtual
Filesys::Virtual::Plain
GD
GD::Graph
GD::Text
Geo::IPfree
Geography::Countries
Getopt::Param::Tiny
GnuPG
Graph::Easy
Graph::Flowchart
HTML::StripTags
HTML::Template
HTTP::Cookies
HTTP::Daemon
HTTP::Daemon::App
HTTP::Daemon::SSL
HTTP::Date
HTTP::Message
HTTP::Negotiate
IO::Compress
IO::HTML
IO::Interactive::Tiny
IO::SessionData
IO::Socket::ByteCounter
IO::Socket::INET6
IO::Socket::SSL
IO::Stringy
IO::Tty
IO::Zlib
IP::Country
IPC::Pipeline
IPC::Run
IPC::Run3
Image::Size
JSON::XS
LWP
LWP::MediaTypes
LWP::Protocol::https
Lchown
Linux::Inotify2
List::Cycle
List::MoreUtils
Locale-Maketext
Locale::Maketext::Utils
Locales
Log::Log4perl
MD5
MIME::Lite
MIME::Types
MLDBM
Mail
Mail::Alias::Reader
Mail::DKIM
Mail::DomainKeys
Mail::SPF
Mail::SRS
Mail::SpamAssassin
Math::Base85
Math::BigInt
Math::Fibonacci
Math::Fibonacci::Phi
Module::Build
Module::Implementation
Module::Metadata
Module::Runtime
Module::Want
Mozilla::CA
MySQL::Diff
Net
Net::AIM
Net::DAV::Server
Net::DNS
Net::DNS::Resolver::Programmable
Net::Daemon
Net::Daemon::SSL
Net::FTPSSL
Net::HTTP
Net::HTTPS::Any
Net::HTTPTunnel
Net::IDN::Encode
Net::IP::Match::Regexp
Net::IPv4Addr
Net::LDAP
Net::LDAP::Server
Net::LibIDN
Net::OSCAR
Net::SNMP
Net::SOCKS
Net::SSLeay
Net::Server
NetAddr::IP
Number::Compare
OLE::Storage_Lite
Package::Stash
Package::Stash::XS
Params::Util
Params::Validate
Parse::CPAN::Meta
Parse::RecDescent
Perl
Perl::OSType
Probe::Perl
Proc::Daemon
Quota
Regexp::Assemble
SOAP::Lite
SQL::Statement
SVG::TT::Graph
Safe::Hole
Set::Crontab
Socket6
Spreadsheet::ParseExcel
Spreadsheet::WriteExcel
String::CRC32
Sub::Install
Sub::Uplevel
Sys::Hostname::Long
Sys::Mmap
Task::Cpanel::Core
Task::Weaken
Template
Term::ReadKey
Term::ReadLine
Test::Carp
Test::Deep
Test::Exception
Test::Fatal
Test::Harness
Test::NoWarnings
Test::Requires
Test::Script
Test::Simple
Test::Tester
Test::Unit
Test::Warn
Text::CSV
Text::CSV_XS
Text::Glob
Tie::DBI
Tie::IxHash
Tie::ShadowHash
Tree::DAG_Node
Tree::MultiNode
Try::Tiny
Types::Serialiser
URI
Unix::PID
Unix::PID::Tiny
WWW::RobotRules
Web::Detect
XML::LibXML
XML::NamespaceSupport
XML::Parser
XML::SAX
XML::SAX::Base
XML::SAX::Expat
XML::Simple
XML::Writer
YAML
YAML::Syck
cPanel::MemTest
common::sense
lib::restrict
local::lib
version
cmd?


Internal Server Error User "username" is over quota

When you try to login to Webmail you will get the below error even if your quota is not reached.

Internal Server Error User ‘username’ is over quota

The following step will fix the issue.

cd /var/cpanel/overquota
[/var/cpanel/overquota]# rm -f username