Tuesday, 20 September 2011

Unable to open pty: No such file or directory


When you try to enter the vps from the node, it gives the following error 

root@amaziah [~]# vzctl enter VEID
enter into CT VEID failed
Unable to open pty: No such file or directory

To resolve this,


root@amaziah [~]#vzctl exec VEID /sbin/MAKEDEV pty
root@amaziah [~]#vzctl exec VEID /sbin/MAKEDEV tty
root@amaziah [~]#vzctl enter VEID


Now to fix the issue for permanently, in the VPS edit /etc/rc.sysinit

#vi /etc/rc.sysinit

comment the line /sbin/start_udev  and add the following lines bellow that,

/sbin/MAKEDEV tty
/sbin/MAKEDEV pty


Now save the file. Then reboot the VPS.


root@amaziah [~]# vzctl restart VEID


 :)

Friday, 16 September 2011

How to disable mod_security for a domain using .htaccess

To disable mod_security using .htaccess, go to the public_html directory of the desired domain. 

Then edit the .htaccess using your favorite editor. 

#vi .htaccess

And add following lines

<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>

Save the file.
DONE!!!!

Saturday, 3 September 2011

How to reset mysql root password

You can reset the MySQL root password using the following command if know the current root password

root@amaziah [~]#mysqladmin -u root -p 'current password' password 'new password'

If you don't know the  root password then, follow the below steps

First stop MySQL server,

root@amaziah [~]#service mysql stop
                    OR
root@amaziah [~]#/etc/init.d/mysql stop


Then edit the following file,

root@amaziah [~]#vi /etc/rc.d/init.d/mysql

edit the line, 

$bindir/mysqld_safe --datadir=$datadir --pid-file=$server_pid_file $other_args >/dev/null 2>&1 &
To
$bindir/mysqld_safe --skip-grant-tables --datadir=$datadir --pid-file=$server_pid_file $other_args >/dev/null 2>&1 &

Then start the MySQL server,

 root@amaziah [~]#/etc/init.d/mysql start

Once the MySQL server is started, you can login to MySQL as root user without password

root@amaziah [~]#mysql -u root mysql

Then enter the following command to set new password for root,

mysql>UPDATE user SET password=PASSWORD ('new password') WHERE user='root';
mysql>flush privileges ;
mysql>quit

Now you have to stop the MySQL server and edit /etc/rc.d/init.d/mysql and change it to as it was before. ie. change the line 

$bindir/mysqld_safe --skip-grant-tables --datadir=$datadir --pid-file=$server_pid_file $other_args >/dev/null 2>&1 &
To
$bindir/mysqld_safe --datadir=$datadir --pid-file=$server_pid_file $other_args >/dev/null 2>&1 &

Once this has been done, start the MySQL server.

root@amaziah [~]#/etc/init.d/mysql start

Done. Now you can login to MySQL using the new password that you have set.  





Friday, 2 September 2011

error : To add, edit, or remove IPs, please contact your server administrator

When you add ip from WHM "Add new IP Address"  you may get the following message

To add, edit, or remove IPs, please contact your server administrator.

To fix this issue, go to backend and add the ip to the file /etc/ips in the format "ip:netmask:broadcast" as shown below.

# vi /etc/ips
192.168.1.244:255.255.255.255:192.168.1.255


Then,

Restart the ipalias service
# /etc/init.d/ipaliases restart
Bringing up venet0:0:cp1                                   [  OK  ]
Routing 192.168.1.244                                     [  OK  ]


Now if it is an openvz vps, then edit the following file

#vi /etc/vz/conf/VzID.conf
#vzctl restart VzID


That's all
We have done it!!!!