How to reset WHMCS admin password via database


You can reset the WHMCS admin password through database using the following steps.

If for some reason password reset email does not arrive to your email address, follow the steps below to reset the password via database.

1. Log in your cPanel and navigate to Databases section. Then go to phpMyAdmin.

2. Once inside, find the database in  which you have installed whmcs and look for tbladmins table. Click on Edit next to the admin user in question.

whmcspass3

Note :

If you do not recall the database name of your WHMCS installation, check configuration.php file located in the root folder. Where you can find the database name  like pasted below.

$db_name = ‘tricks_whmcs’

In the above example, tricks_whmcs is the database name.

3.  On the next page look for password column.

In the last field enter the new password and select MD5 hash option. In the passwordhash column you need to remove the value from the last field.

whmcspass4

4. Once done, scroll down to the bottom of the page and click on Go.

 

Clear /tmp using tmpwatch


Tmpwatch tool is analyze and recursively delete files which have not been used certain period of time, especially clean up unwanted backup or /tmp directory or unused files.

When changing directories, tmpwatch is very sensitive to possible race conditions and will exit with an error if one is detected. It does not follow symbolic links in the directories it’s cleaning (even if a symbolic link is given as its argument), will not switch filesystems, and only removes empty directories and regular files.

Installation of tmpwatch

——————-

You can install tmpwatch on your linux server with simple commands.

CentoOS/Fedora/RHCE :

yum install tmpwatch -y

Ubuntu:

sudo apt-get install tmpreaper

Once it’s installed, you can find the tmpwatch Installed Location uisng the following command.

 whereis tmpwatch

 

OPTIONS

-u, –atime

Make the decision about deleting a file based on the file’s atime (access time). This is the default.

-m, –mtime

Make the decision about deleting a file based on the file’s mtime (modification time) instead of the atime.

-c, –ctime

Make the decision about deleting a file based on the file’s ctime (inode change time) instead of the atime; for directories, make the decision based on the mtime.

-a, –all

Remove all file types, not just regular files and directories.

-d, –nodirs

Do not attempt to remove directories, even if they are empty.

-f, –force

Remove files even if root doesn’t have write access (akin to rm -f).

 

Commands using tmpwatch

———————-

1. To cleanup /tmp directory files that haven’t been accessed for at least 30 days.

tmpwatch 30d /tmp/

2. To delete all /tmp files and directories over 12 hours old

tmpwatch -am 12 /tmp

3.To delete all the files only  that haven’t been accessed for at least 30 hours.

 tmpwatch -am  30 –nodirs /tmp

We can also set cron jobs to run the same automatically by server. You can add the cron job like pasted below sing your cPanel or as root user.

 0 4 * * * /usr/sbin/tmpwatch -am 12 /tmp

That’s all….!!!

Reducing outgoing network traffic by changing the local port range


If your Linux server is opening lots of outgoing network connections, you need to increase local port range. By default range is small. For example a squid proxy server can come under fire if it runs out of ports.

You can use the sysctl command to to modify kernel parameters at runtime. The parameters available are those listed under /proc/sys/. Please note that this hack is only useful for high bandwidth, busy Linux servers or large scale grid servers.

How to find current port range type

You can find the current port range using the following command.

sysctl net.ipv4.ip_local_port_range

Sample outputs:

net.ipv4.ip_local_port_range = 32768    61000

 

Set new local port range

You can set the range with any one of the following command. You must be root user:

echo 1024 65535 > /proc/sys/net/ipv4/ip_local_port_range

Otherwise you can use the following command.

sudo sysctl -w net.ipv4.ip_local_port_range=”1024 64000″

Finally, edit /etc/sysctl.conf file, to make changes to /proc filesystem permanently i.e. append the following line to your /etc/sysctl.conf file:

# increase system IP port limits

                net.ipv4.ip_local_port_range = 1024 65535

That’s all…!!!

NginxCP: Install Nginx as reverse proxy on cPanel server


We know that both Apache and Nginx are powerful and effective web-servers. Apache is the topmost webserver since it was released in 2006 and Nginx is now using top websites. The reason for using Apache and Nginx are clear, Apache’s power and Nginx’s speed.

By setting Nginx as reverse proxi, we can increase the websites speed and performance in the server. This is because, Nginx will take care of att static contents in the website such as CSS, images, SWF files, MP4 and more and Apache will manage the rest of requests (dynamic requests – php page). This is known as Nginx reverse proxy setup. Nginx stand as front end servers with a powerful backend Apache server.

nginxCP is a cpanel plugin that is used to manage nginx service in cpanel server. As we know that nginx can handle static contents better than apache, we will configure nginx to run on port 80 and will forward dynamic requests to apache on port 8081.

Installation

—————

To configure nginx as revcrse proxy, we need to install an apache module mod_rpaf.

Mod_rpaf installation:

First of all we need to login as root to do the full installation process. After login, you can proceed with following commands.

 

# cd /usr/local/src

                  # wget https://nginxda.googlecode.com/files/mod_rpaf-0.6.tar.gz

                 # tar xvzf mod_rpaf-0.6.tar.gz

                 # cd mod_rpaf-0.6

                 # /usr/local/apache/bin/apxs -i -c -n mod_rpaf-2.0.so mod_rpaf-2.0.c

For Apache 2.4 : You need to apply a patch for mod rpaf. For that run the following commands.

    

                 # git clone git://gist.github.com/2716030.git

                 #patch mod_rpaf-2.0.c 2716030/mod_rpaf-2.0.c.patch

Now we are going to install nginxCP plugin. Since we need to run both Apache and nginx on the same server, we have to assign both of them in different ports. You can change apache port to 8081 from your whm tweak settings and nginx will listen to 80 as default.

For changing the Apache port, please login to WHM and go to Tweak settings.

—————————————

WHM > Server Configuration > Tweak Settings > Apache non-SSL IP/port. 

—————————————

change he port to 8081 on “Apache non-SSL IP/port” option.

Now we can proceed with nginxCP installation using the following commands.

# cd /usr/local/src

                # wget http://nginxcp.com/latest/nginxadmin.tar

                # tar xf nginxadmin.tar

                # cd publicnginx

                # ./nginxinstaller install

                # /usr/local/cpanel/whostmgr/bin/whostmgr ./setrhash

To server static files using nginx, you have to  convert apache virtualhost to nignx virtualhost. You can download the script at http://blog.supportmonk.com/nginx.txt ,  rename it as nginx.sh , provide 755 permission and execute it. You have to create an empty file /usr/local/nginx/conf/vhost.conf

  # touch /usr/local/nginx/conf/vhost.conf

              # wget  http://blog.supportmonk.com/nginx.txt

              #  cp nginx.txt nginx.sh

              # chmod 755 nginx.sh

              # ./nginx.sh

Configuration is complete. You can test nginx configuration and can start it.

 

# /usr/local/sbin/nginx -t

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok

nginx: configuration file /etc/nginx/nginx.conf test is successful

# /etc/init.d/nginx start

While testing, there is a chance to get the following error.

——————————-

nginx: [emerg] unknown “no_cache” variable
nginx: configuration file /etc/nginx/nginx.conf test failed

——————————-

This error would be occured when you don’t have any accounts. Try to create an account using WHM and run the test command again.

That’s all..!!

Installing and configuring Spamassassin on CentOS server


If you run your own mail server you’ll want it to run spam filtering software to reduce the number of unsolicited emails your users receive.  SpamAssassin is an effective spam filter that’s relatively easy to install and run.

Installation

—————

The first thing we will want to do is run an update on our CentOS distribution if we haven’t already.

      yum update

Once the distribution has been updated, we will want to install SpamAssassin using yum.

     yum install spamassassin

Now that we have installed SpamAssassin onto our mail server we will need to configure the SpamAssassin rules within the local.cf file to set filter preferences.

Each item of email sent to your domain is given a score by SpamAssassin.  This score depends on characteristics of the email like keywords and attachments. As with any anti-spam engine, SpamAssassin will need training to become a more accurate filter to cater to your needs.

Configuration

—————–

Let’s take a look at the default configuration for the local.cf file within SpamAssassin.  To do this we will need to open the file and make some changes.  Please use your favoured text editor; in this example we will use nano.

      nano /etc/mail/spamassassin/local.cf

We will need to uncomment the following lines and append the score:

            required_hits 5.0
            report_safe 0
            required_score 5
            rewrite_header Subject ***SPAM***

To explain what we are doing and why we are doing this, we will need a short run-down on the above lines.

Required_hits: This determines the filter balance; the lower the score the more aggressive the filter. A setting of 5.0 is generally effective for a small organisation or a single user. Adjust the strictness score to your organization’s needs – a large medical organisation might want to let email items through that are trying to sell pharmaceuticals, so we might increase the level to a more modest 8.0.

Report_safe: This line determines whether to delete the item or to move the item to the inbox whilst appending a spam notice to the subject line. The levels for this line are set to either a 1 or 0. A score of 1 will delete the spam item, whereas a score of 0 will send the item to the inbox and rewrite the subject line. For this guide we shall use 0 as the score.

Required_score: This line sets the spam score for all email alllowed through to your domain, with levels of certainty set from 0 to 5. Zero would be classified as a legitimate email item, whereas 5 would be an definite ‘SPAM’ item. If we set the score to 3 we would catch a lot of unsolicited emails but quite a few false positives would still get through. For our example email server we will use the score of 5, but you can of course set this value according to your preference.

Rewrite_header: This line does exactly what it implies, that is, any message caught as ‘SPAM’ will have the subject line rewritten to include this header. For this guide we will use the default subject header of ***SPAM***.

Now that we have the spam variables set up we will now move on to creating the spamd function.

Spamd Setup

—————

Spamd and spamc are two functions that are necessary for SpamAssassin to work correctly. Spamd is the more proactive of the two functions; it lays in wait for incoming requests, acting as a daemon to intercept and process emails. Once spamd receives a connection it will spawn a spawnc child to read the email item from the network socket. This child will pass the message back to spamd when it reaches an end of file (EOF), which will rewrite the message (if you have SpamAssassin setting the subject header for spam). This email message will then be passed back to the socket it originally arrived on using the child process it spawned at the start. The child process will then end and your regular mail server will process the message.

In briefer terms: The spamd process and its children intercept all incoming messages and process them before your regular mail server ever sees them.

Because of the nature of spamd we will need to create a unique user and group for it so we can integrate Postfix with SpamAssassin. This can be done using commands in BASH:

               groupadd spamd
               useradd -g spamd -s /bin/false -d /var/log/spamassassin spamd
               chown spamd:spamd /var/log/spamassassin

Right, so now that we have the SpamAssasin local.cf file configured along with spamd we will need to configure the Postfix master.cf file to use the SpamAssassin scripts and the set scores we have just applied.

Postfix
We now need to access the Postfix master.cf file with a text editor.

       nano /etc/postfix/master.cf

We should now change the master.cf file to look as follows:

# ====================================================================
# service type private unpriv chroot wakeup maxproc command + args
# (yes) (yes) (yes) (never) (100)
# ====================================================================
smtp inet n – n – – smtpd -o content_filter=spamassassin

At the bottom of this file we should add the following line:

spamassassin unix – n n – – pipe flags=R user=spamd argv=/usr/bin/spamc -e /usr/sbin/sendmail -oi -f ${sender} ${recipient}

Before initially starting the SpamAssassin service run sa-update from a cronjob to update the spamd with the latest rules.

      sa-update && /etc/init.d/spamassassin reload

We should now start the SpamAssassin service and reload the Postfix service, to do this we can run the following commands:

        /etc/init.d/postfix reload

        /etc/init.d/spamassassin reload

To check the spam service is operating correctly we can try running a test.

The Test

———–

Create an email from an email address and service outside of your domain, e.g. Hotmail or Gmail. Address the email to an email address on the newly-configured mail server, then within the subject line we can use the following test string:

XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X

Once this email has been fired off, and if all the settings have been entered correctly, we should be able to see the following message in our inbox:

****SPAM****XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X

Success! We have now set up our server to use SpamassAssin to filter our inbound emails!

That’s all…!!!

Failed to retrieve directory listing


Issue:

I got the above error while using Filezilla.

———————–

Response: 200 PORT command successful. Consider using PASV.
Command: LIST
Error: Connection timed out
Error: Failed to retrieve directory listing

————————

Solution:

1. Try after disabling the firewall.

2. If the issue still happens, please proceed with editing the filezilla configuration with following steps.

  • Open Filezilla, go to Edit -> Settings
  • Click on Connection -> FTP: Choose Active
  • Click on Connection -> FTP -> Active Mode: Select “Ask your operating system for the external IP address”
  • Click on Connection -> FTP -> Passive Mode: Choose Fall Back to Active Mode
  • Press OK.

3. Please have  a try now to connect using filezilla.

That’s all…!!!

Internal error: Error retrieving pid file logs/httpd.pid


Issue:

I got the above error while restarting Apache.

———————-

# /etc/init.d/httpd start

(20014)Internal error: Error retrieving pid file logs/httpd.pid
Remove it before continuing if it is corrupted.

————————-

Solution:

1. Use the following command

mv /usr/local/apache/logs/httpd.pid /usr/local/apache/logs/httpd.pid.bk

2. Now try to start the Apache.

/etc/init.d/httpd restart

3.You can check the status using the following command.

/etc/init.d/httpd status

That’s all…!!!

ZPanel zadmin password Reset


You can reset the zpanel admin panel using the following steps.

1. Login to the server as root user.

2. Then type the following command

setzadmin –set password

Note: In “password” area type “your new password”

ZPanel backend files


ZPanel

————–

ZPanel is a free and complete web hosting control panel for Microsoft Windows and POSIX (Linux, UNIX and MacOSX) based servers.ZPanel is written in PHP and uses several open-source (or freely available) software packages to provide a secure, web hosting system.

Backend Files

————–

Ubuntu

———-

Password file –  /root/passwords.txt
ZPanel config files –  /etc/zpanel/configs/
ZPanel apache config file –  /etc/zpanel/configs/apache/httpd.conf –
ZPanel virtual host file –  /etc/zpanel/configs/apache/httpd-vhosts.conf
ZPanel website files –  /etc/zpanel/panel/
ZPanel FTP config file –  /etc/zpanel/configs/proftpd/proftpd-mysql.conf
ZPanel log files – /var/zpanel/log/
ZPanel users websites –  /var/zpanel/hostdata/[zpanel-login]/public_html/
ZPanel custom static pages – /etc/zpanel/panel/etc/static/
ZPanel themes –  /etc/zpanel/panel/etc/styles/
Apache config file – /etc/apache2/httpd.conf
Apache log files – /var/log/apache2/error.log
Php.ini –  /etc/php5/apache2/php.ini
Mysql config file –  /etc/mysql/my.cnf
Mysql log file –  /var/log/mysql/error.log

Centos

————-

ZPanel password file- /root/passwords.txt
ZPanel config files – /etc/zpanel/configs/
ZPanel apache config file – /etc/zpanel/configs/apache/httpd.conf –
ZPanel virtual host file – /etc/zpanel/configs/apache/httpd-vhosts.conf
ZPanel website files – /etc/zpanel/panel/
ZPanel FTP config file – /etc/zpanel/configs/proftpd/proftpd-mysql.conf
ZPanel log files – /var/zpanel/log/
ZPanel users websites – /var/zpanel/hostdata/[zpanel-login]/public_html/[sub_domain_tld]
ZPanel custom static pages – /etc/zpanel/panel/etc/static/
ZPanel themes – /etc/zpanel/panel/etc/styles/
Apache config file – /etc/httpd/conf/httpd.conf
Apache log files – /var/log/httpd/error.log
Php.ini – /etc/php.ini
Mysql config file – /etc/my.cnf
Mysql log file – /var/log/mysqld.log

Extending Swap space on an LVM


Sometimes it is necessary to add more swap space after installation. For example, you may upgrade the amount of RAM in your system from 1 GB to 2 GB, but there is only 2 GB of swap space. It might be advantageous to increase the amount of swap space to 4 GB if you perform memory-intense operations or run applications that require a large amount of memory.

You have three options: create a new swap partition, create a new swap file, or extend swap on an existing LVM2 logical volume. It is recommended that you extend an existing logical volume.

To do so, perform the following procedure (assuming /dev/VolGroup00/LogVol01 is the volume you want to extend by 2 GB):

1.Disable swapping for the associated logical volume:

# swapoff -v /dev/VolGroup00/LogVol01

2.Resize the LVM2 logical volume by 2 GB:

# lvresize /dev/VolGroup00/LogVol01 -L +2G

3.Format the new swap space:

# mkswap /dev/VolGroup00/LogVol01

4.Enable the extended logical volume:

# swapon -v /dev/VolGroup00/LogVol01

To test if the logical volume was successfully extended, use “cat /proc/swaps” or “free -m” to inspect the swap space.

Previous Older Entries Next Newer Entries

Blog Stats

  • 37,402 hits