Wednesday, September 7, 2011

nameserver ips showing old ips in cpanel

Even after changing the nameserver ips, the nameserver ips in WHM may show old ips. This post explains how to change the nameserver ip addresses in a cpanel server.
You can change this as follows:

First edit the /etc/nameserverips

root@test[~]# cat /etc/nameserverips

Now edit /var/cpanel/nameserverips.yaml

root@test[~]# cat /var/cpanel/nameserverips.yaml
  IP_address1: 1
  count: '3'
  zones: ns1.domain.tld,domain.tld,ns2.domain.tld
  IP_address2: 1
  count: '3'
  zones: ns1.domain.tld,domain.tld,ns2.domain.tld

Names of zones files can be found in /etc/named.conf
Now restart the cpanel
root@test[~]# /etc/init.d/cpanel restart

Thats it. It should effect the changes on WHM

Resetting kloxo password

In case if you forgot your kloxo admin password, you have to reset the password for login again. This post explains how to reset the password for admin for kloxo lxadmin control panel.

#cd /usr/local/lxlabs/kloxo/httpdocs
#/usr/bin/lphp.exe ../bin/common/resetpassword.php master PASSWORD

Thats it. Now the admin password is changed to PASSWORD

Tuesday, September 6, 2011

vzctl start Container already locked

While starting the openvz container you may get an error like this
Container already locked

You wont be able to start, restart or stop the container. It is because the container is locked.

Delete the /vz/lock/VEID.lck file (where VEID is the number of your VPS).
vzctl chkpnt VEID --kill

Now start the vps.
vzctl start VEID

hypervm adding ip to /etc/hosts.deny

You may get this error while sshing to a ip
ssh_exchange_identification: Connection closed by remote host

It could be because of many reasons. One of them is hypervm adding the ips to /etc/hosts.deny file.
It will add the ip again if you remove it from /etc/hosts.deny.

The solution is after removing the ip, run this command

chattr +i /etc/hosts.deny

Sunday, September 4, 2011

jail environment using vsftpd

This post explains how to limit users to only their home directory in vsftpd ftp demon so that the users will be in a jail environment and he can not change to other directories.

Open the vstpd configuration file
vi /etc/vsftpd/vsftpd.conf

Add the following variable


Restart the vsftpd service
/etc/init.d/vsftpd restart

Now on wards when the user logs in via ftp he gets into his home directory. But he cannot change the directory out of it. This is known as jailed environment. 

Backing up and restoring mysql databases

Tacking the back up of a database
mysqldump  -u username -ppassword  database_name > database_name.sql
For example
mysqldump  -u root -pabc123 horde > horde.sql

Restoring the database
mysql database_name < database_name.sql
For example
mysql horde < horde.sql

Restart the mysql
/etc/init.d/mysqld restart