web analytics

Category Misc

CSF on SolusVM Node

One of my clients wanted to secure their slave nodes with a firewall, and asked to install CSF on the servers. We setup a new slave node and installed CSF and everything was working fine. Created a new VPS, and noticed that the VPS IP Address is not responding. There was no ping to the VPS IP Address from outside. Logged into the server via console and the IP Address was up in the server. However there was no inbound and outbound network connections.

[root@vps ~]# ping google.com

Thinking it could be a resolver problem, I switched the resolver entries to use google DNS as follows.

[root@vps ~]# vi /etc/resolv.conf

Enter the following


Save and quit the file. Tried to ping google.com again from the server and it timed out again...

Read More

Solusvm Access Denied !

I was working on my client’s solusvm admin panel that I got kicked out suddenly. I started getting the following message, whatever way I tried to access the admin control panel.

Access Denied! Contact the system administrator for support

I tried various ways to gain access, but nothing worked. The following trick helped me.

I logged in to the server as root via ssh and whitelisted my IP Address.

[root@abc ~]# cd /usr/local/solusvm/tmp/
[root@abc ~]# touch fixwhitelist
[root@abc ~]# chown solusvm.solusvm fixwhitelist
[root@abc ~]# vi fixwhitelist

Then enter your IP Address in that file, save and restart solusvm.

[root@abc ~]# /etc/rc.d/init.d/solusvm restart
Stopping solusvm: [ OK ]
Starting solusvm: [...

Read More

Hetzner server with > 2TB disk

Recently I ordered a Hetzner server for one of our clients. The server had two 3TB disks. Hetzner provides a command line installation of the desired OS once we login to their server. As such, I logged in to the server and installed Centos6 by executing “installimage” option as suggested by Hetzner.

After installing OS and rebooting the server, I noticed that the 3T disk is not showing full space.

[root@abc ~]#df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda3        99G  2.5G   91G   3% /
tmpfs           463M     0  463M   0% /dev/shm
/dev/sda2       976M  126M  800M  14% /boot

/dev/sda4   2.3T     123M   2.2T  1% /home

If the disk size is greater than 2T you cannot use normal fdisk to create partition...

Read More

Fatal error: Class ‘Net_SMTP’ not found in /usr/local/lib/php/Mail/smtp.php on line 349″

I was trying to setup a php script to send mail with SMTP Authentication. The script was ready, but when executed in a browser, it displayed the following error.

Fatal error: Class ‘Net_SMTP’ not found in /usr/local/lib/php/Mail/smtp.php on line 349″

The problem appears because the php pear package Net_SMTP is not present in the server. You can install it in two way.

  1. Install the Mail package with –alldeps which will install all required dependencies like Net_SMTP

pear install –alldeps Mail

If Mail is already installed, and if it refuses to get installed then you can force the installation as follows.

pear install –alldeps -f Mail

2.  If Mail is already installed, then you can install the Net_SMTP option alone as follows.

pear install Net_SMTP

After that, execute the script again and...

Read More

df showing wrong result

My mysql server suddenly started showing my disk space usage as almost full.

[root@abc /]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda3       550G  508G   14G  98% /
tmpfs            32G     0   32G   0% /dev/shm
/dev/sda1       2.0G  173M  1.8G   9% /tmp

But when I issued a disk usage check on / , it returned the usage to be very little.

[root@abc /]# du -sch
47G     .
47G     total

I was sure there is something wrong. Hence, I checked for deleted files. You can use either of the following commands.

[root@abc /]# lsof +L1

mysqld    23193     mysql    5u   REG    8,1          184     0       13 /tmp/ibrUf6yr (deleted)
mysqld    23193     mysql    6u   REG    8,1            0     ...

Read More

(28)No space left on device: mod_rewrite: Parent could not create RewriteLock file

Noticed this error in a cpanel server while starting apache. Apache refused to start with the following error.

(28)No space left on device: mod_rewrite: Parent could not create RewriteLock file

Seeing the error, the first thing that I checked was the disk space in the server but it looked fine.

root@abc [~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg0-root   16G  1.2G   14G   8% /
/dev/mapper/vg0-home  249G  124G  113G  53% /home
/dev/mapper/vg0-var    23G  7.0G   15G  33% /var
/dev/mapper/vg0-usr    23G  7.6G   14G  36% /usr
/dev/mapper/vg0-tmp   9.5G  151M  8.9G   2% /tmp
/dev/sda1             7.4G  184M  6.9G   3% /boot
tmpfs                 7.9G     0  7...

Read More

Accessing Gmail with Roundcube

Requirement : I want to access my gmail under my own domain with the help of webmail.

Say my domain name is abc.com , I want to access it as http://abc.com/mail

Suppose I am on a cpanel server. Download and install Roundcube as follows.

root@me [/home/abc/public_html]# wget http://downloads.sourceforge.net/project/roundcubemail/roundcubemail/1.0.0/roundcubemail-1.0.0.tar.gz

root@me [/home/abc/public_html]# tar -xzvf roundcubemail-1.0.0.tar.gz

root@me [/home/abc/public_html]# mv roundcubemail-1.0.0 mail

root@me [/home/abc/public_html]# chown -R abc:abc mail

root@me [/home/abc/public_html]# cd mail

Now login to your cpanel and create a database for roundcube installation, create a database user and assign privileges. This can all be done from cpanel.

Once done, go to the installer link as ...

Read More

Migrating emails from mailenable to exim

I wanted to transfer my entire sites from my Windows Plesk server to Linux Cpanel server. I could simply create the new accounts in the new server and copy the files. The main issue was with emails. My windows server was using mail enable, where as the the cpanel server uses exim.

I realized I will have to create all email accounts manually in the new server. A simple tool which will do everything in a click was not available. Losing email was not something I could let happen, so I decided to go ahead with creating accounts and then copying emails. I used imapcopy for it. If anybody wants to do it, you can do it as follows. I am copying the email account test@abc.com to new server. Its password is test123c on both servers.

root@abc [~]# cd /usr/local/src/

root@abc [/usr/local/src]#  wget ...

Read More

Sharding in MongoDB

Sharding refers to the process of distributing data across multiple servers which helps in retrieving it easily. When the data set is huge, it is said that sharding significantly improves the query response time.

Let us see how we can implement sharding. Sharding requires a  minimum of three servers for test purpose. In production scenario, sharding may require more servers.

Sharding is implemented through the following :-

1) Config Servers – These servers contain the metadata as to where the data belongs to. Means, it holds data as to which shard each data goes. A minimum of 2 config servers in a huge databases system is recommended.

2) Query Router Servers – These servers are the ones that communicate with the application directly...

Read More

Find the number of FTP connections along with the connected IP Addresses

You can use the following t o find which all IP Addresses are connected to server via FTP as well as the number of connections.

netstat -tpn | grep pure-ftpd | awk ‘{print $5}’ | cut -d”:” -f1 | sort | uniq -c | sort -nr

Read More