This will fix your issues, with curl: (77) Problem with the SSL CA cert (path? access rights?)# yum reinstall ca-certificates # yum reinstall openssl
Saturday, December 28, 2013
curl: (77) Problem with the SSL CA cert (path? access rights?)
This is an issue with ca-certificates that bundles with the server. You
may simply need to reinstall the following packages for fixing this
issue.
Etiquetas:
How-To
How to Configure Multiple shared IP’s in WHM
You can’t add multiple shared IPs in WHM GUI, but it’s possible to do so via SSH (login as root).
First, you need to create a /var/cpanel/mainips/ directory, if it doesn’t exist:
You can verify from WHM>>Home>>IP Functions>>Show/Edit Reserved IPs
First, you need to create a /var/cpanel/mainips/ directory, if it doesn’t exist:
Then, create a /var/cpanel/mainips/root file, with all the Ips as folllows# mkdir /var/cpanel/mainips/
Basically, each line is an additional shared IP in WHM. That’s it!10.0.0.10 10.0.0.12
You can verify from WHM>>Home>>IP Functions>>Show/Edit Reserved IPs
Etiquetas:
cPanel/WHM
Change of default page in cpanel/WHM
In WHM, look for "Account Functions" and choose "Skeleton Directory".
This will show you where your directory is. Anything you add to your
skel directory will automatically be added to the users directory when
you create a new account.
If you place a default HTML page within the "public_html" sub-directory then it will be included within the public_html directory of the user's new account upon creation.
Example paths:
If you place a default HTML page within the "public_html" sub-directory then it will be included within the public_html directory of the user's new account upon creation.
Example paths:
/root/cpanel3-skel /root/cpanel3-skel/public_html /root/cpanel3-skel/public_html/index.html
Etiquetas:
cPanel/WHM
Saturday, December 7, 2013
How to fix the FTP time out error
How to resolve the error :
This error occurs when we are able to connect using FTP but folder listing fails!
Resolution:
1)Login to the WHM==> FTP Server Selection
2)change the FTP server to Pure-FTPD from PRO-FTP ==> Save
3)Now ssh into the server as root and open the pure-ftp conf file /etc/pure-ftpd.conf
4)Find the FTP port no: used the “PassivePortRange” from the config file
5)Add the port range into the config file
for eg :
7)Open the csf(firewall) config file, add the ftp port along with the passive port range
eg :
[bash]!connection failed xx.xx.xxx.xxx – connection timed out
!connectio:error 0
PORT xxx,xxx,x,x,x,xxx
500 Illegal PORT command
!Failed "port"
!Retrieve of folder listing failed (0)[/bash]
This error occurs when we are able to connect using FTP but folder listing fails!
Resolution:
1)Login to the WHM==> FTP Server Selection
2)change the FTP server to Pure-FTPD from PRO-FTP ==> Save
3)Now ssh into the server as root and open the pure-ftp conf file /etc/pure-ftpd.conf
4)Find the FTP port no: used the “PassivePortRange” from the config file
5)Add the port range into the config file
for eg :
[bash][/bash]PassivePortRange 30000 40000[bash][/bash]6)Save and quit
7)Open the csf(firewall) config file, add the ftp port along with the passive port range
eg :
[bash][/bash]# Allow incoming TCP ports8)Restart csf & Pure-ftpd
TCP_IN = “20,22,25,53,80,110,143,443,465,587,993,995,2001,2077,2078,2082,2083,2086,2087,
2095,2096,30000:40000″[bash][/bash]
How to fix the WHM CSF security test errors!
As a part of ensuring security, we perform a CSF security scan from WHM. We may get the following error after the scan
Check csf LF_SCRIPT_ALERT option WARNING This option will notify you when a large amount of email is sent from a particular script on the server, helping track down spam scripts
To fix this error : ssh into the server and edit the csf configuration file
vi /etc/csf/csf.conf
search for LF_SCRIPT_ALERT = “0″
Change the value from “0″ to “1″ to fix the issue.
Don’t forget to restart the CSF
You may also get the following error :
Etiquetas:
cPanel/WHM,
csf,
exim,
firewall,
LF_SCRIPT_ALERT,
log_sector,
Security
cPanel icons missing on WHM
Usually WHM allows you to login to the cPanel accounts from the
“List Account” option. But sometimes you may not able see the cPanel
icons which prevents you to login to the cPanel account as root.
FIX:-
goto “Tweak Settings” and uncheck the option below
FIX:-
goto “Tweak Settings” and uncheck the option below
Disable login with root or reseller password into the users’ cPanel interface. Also disable switch account dropdown in themes with switch account feature.
Etiquetas:
cPanel/WHM,
How-To
How to change Linux root password temporarily.
This is a simple technique by which you can have your our root
password temporarily and change it back to the real one after use. The
condition is
* You are logged in as root and you don’t know the root password
Back-up the current shadow file.
* You are logged in as root and you don’t know the root password
Back-up the current shadow file.
[root@localhost ~]# cp /etc/shadow /etc/shadowbkupChange the current root password the desired one.
Etiquetas:
change linux root password,
hack linux,
How-To
How to transfer a cPanel account to DirectAdmin.
The file structure and back-ups for both
control panels are entirely different and its quite difficult to
restore the files transfered from one to another control panel manually.
There is a script available which can convert a cPanel back-up to the
format that of a DirectAdmin. The convert process is quite simple.
Download the conversion script from here .
*You can download it using the terminal :
*Create two directories import and export :
mkdir import export
Find Linux OS is 32 or 64bit.
There are several situations where you
need to confirm whether your Linux OS installed is 32bit or 64bit.
People normally use uname -a to find it. But the following command will
tell you exactly the machine architecture.
getconf LONG_BIT
getconf utility shall conform to the Base Definitions volume of IEEE Std 1003.1-2001, Section 12.2, Utility Syntax.
eg:
[root@localhost ~]# getconf LONG_BIT
32
[root@localhost ~]#
32
[root@localhost ~]#
My machine is 32bit.
Etiquetas:
23bit or 64bit,
Linux,
linux 32 or 64bit.,
linux arcticture
How to disable gzip output on lightspeed server accounts
You can use .htaccess to disable gzip output if your website is running under a lightspeed server.
Open .htacess file and append following lines.php_flag zlib.output_compression Off
RewriteEngine On
RewriteRule . – [E=no-gzip:1]
RewriteRule ^(.*)$ $1 [E=no-gzip:1]
Etiquetas:
disable gzip output,
How-To,
lightspeed disable gzip
How to configure NAT with iptables on a VPS.
NAT ( network-address-translation ) with
iptables helps us in how to select the packets we want to mangle. We
can easily configure NAT on a OpenVZ VPS by following the below steps.
Lets first consider a VPS in which NAT is not enabled. Trying to POSTROUTE from VPS throws you errors.
iptables -t nat -A POSTROUTING -s 10.9.0.0/24 -o venet0 -j SNAT –to 111.140.170.134
or iptables -t nat -nvL
iptables v1.3.5: can’t initialize iptables table `nat’: Table does not exist (do you need to insmod?)To Enable NAT :
Perhaps iptables or your kernel needs to be upgraded.
* Login to Node server.
Check vzcinfiguration file to find whether NAT is enabled or not.
grep -i iptables /etc/vz/vz.conf
You will get
Etiquetas:
enable NAT on vps,
How-To,
iptables NAT,
NAT for iptables,
vz NAT
Exim: remove mails in queue from a particular sender.E
“spams”, its one of the major issue that a sys admin has to deal with throughout his job. First you need to find the user who is generating it. You can get it from the mail headers. Once you find the user, disable the script that was responsible for spams, but it may have already kept thousands(may be lacks) of mails in the exim queue waiting for its chance to get delivered. To delete these mails one by one is impossible. In a cPanel server having exim mail, you can use the following command to delete mails in the current queue generated by that particular user only.
SSH into the server
-i print messages id
-f from address
-Mrm remove mails
Remove mails to a particular sender in the queue :-
exiqgrep -i -t user@domain.com | xargs exim -Mrm
-t to address
SSH into the server
exiqgrep -i -f user@domain.com | xargs exim -Mrm
-i print messages id
-f from address
-Mrm remove mails
Remove mails to a particular sender in the queue :-
exiqgrep -i -t user@domain.com | xargs exim -Mrm
-t to address
Etiquetas:
exim queue,
How-To
How to enable DKIM in cPanel server.
DomainKeys Identified Mail (DKIM) lets an organization take responsibility for a message while it is in transit and one can use this to prevent from getting blacklisted by the free email providers like Yahoo, MSN and Google. DKIM can increase the mail authenticity.
cPanel does not have an interface to enable DKIM like we have for SPF and Domain Keys. cPanel is still working on it for getting it implemented. However we can enable it manually by following the below steps.
Check if exim is compiled with DKIM support enabled.
cPanel does not have an interface to enable DKIM like we have for SPF and Domain Keys. cPanel is still working on it for getting it implemented. However we can enable it manually by following the below steps.
Check if exim is compiled with DKIM support enabled.
[bash]root@server # /usr/sbin/exim -dd 2>&1 | grep Experimental_DKIM[/bash]
[bash]Support for: crypteq iconv() IPv6 PAM Perl OpenSSL Content_Scanning Old_Demime Experimental_SPF Experimental_SRS
Experimental_DomainKeys Experimental_DKIM[/bash]
Etiquetas:
cPanel/WHM,
How-To,
Linux
Tuesday, November 26, 2013
HowTo Uninstall RVSkin
This is the duty of root/admin to do by running the following command.
if for some reason RVskin was installed in a different location, change the path accordingly.
To complete this, restart cpanel:
perl /root/rvadmin/uninstall.pl
if for some reason RVskin was installed in a different location, change the path accordingly.
To complete this, restart cpanel:
/etc/rc.d/init.d/cpanel restart
Etiquetas:
cPanel/WHM,
How-To,
WHM Plugins
How to change your hostname with SSH
If you’ve worked in the admin world for any length of time, you’ve
probably run into an instance where you needed to change the hostnames
on your server to match some corporate naming standard, but you can’t
have downtime either.
First, you must change the config file that controls this. The actual file and its location will vary across distributions. In the Redhat derivatives, the file to modify is /etc/sysconfig/network so vi this file and change the line that reads HOSTNAME=
Changing the Hostname
First, you must change the config file that controls this. The actual file and its location will vary across distributions. In the Redhat derivatives, the file to modify is /etc/sysconfig/network so vi this file and change the line that reads HOSTNAME=
Sunday, November 3, 2013
How do I install Installatron on DirectAdmin
The overall Installatron installation process is quite simple and super streamlined for the industry famous Installatron. Simply, follow the step-by-step installation process and you’ll quickly and easily have Installatron installed on your DirectAdmin control panel:
Login to your DirectAdmin via SSH as root
From the SSH command prompt run the following line:
Login to your DirectAdmin via SSH as root
From the SSH command prompt run the following line:
cd /home/ && mkdir installatron && cd installatron &&
wget http://data1.installatron.com/installatron/installatron_setup.sh &&
chmod +x installatron_setup.sh &&
./installatron_setup.sh –f
Etiquetas:
Direct-Admin,
How-To,
Installation
Friday, September 20, 2013
cPremote version 6.6 is available now – Compatible with cPanel 11.36
An updated version of cpremote , 6.6 is available now for download. This version is fully compatible with cPanel version 11.36
Change Log:
Upgrade:
It will be automatically upgraded to the new version. If you like to upgrade it manually, then simply run the cpremote installer in your server.
Change Log:
Removed the use of /var/cpanel/3rdparty/bin/php
Added new CPPHP support
Upgrade:
It will be automatically upgraded to the new version. If you like to upgrade it manually, then simply run the cpremote installer in your server.
Etiquetas:
News & Updates
Add a wild card domain in danginx ( Directadmin Nginx )
By default danginx won’t include the custom wild card domains. But you can create a vhost configuration as follows. Suppose if you need to create a wild card domain *.foo.com with user name “foo” and document root ” /home/foo/domains/foo.com/public_html and IP 10.0.0.10 , then
1) Create a file name /etc/danginx/foo.conf with the following content
1) Create a file name /etc/danginx/foo.conf with the following content
Vhost configuration of *foo.com
#################################################################
server {
access_log off;
error_log logs/vhost-error_log warn;
listen [::]:80;
server_name *.foo.com;
location ~* ^.+.(jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|iso|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|mp3|ogv|ogg|flv|swf|mpeg|mpg|mpeg4|mp4|avi|wmv|js|css)$ {
Etiquetas:
cPanel/WHM,
Direct-Admin
Nginx And DDOS Protection
cPnginx and Danginx can use to protect the HTTP DDOS as follows,
Edit the file /etc/sysctl.conf and increase the openfile limits. Add the following line,
fs.file-max = 700000
Edit /etc/security/limits.conf and add the following lines,
nobody soft nofile 100000
nobody hard nofile 500000
Now apply the sysctl configuration using the following command .
# sysctl -p
Edit the file /etc/sysctl.conf and increase the openfile limits. Add the following line,
fs.file-max = 700000
Edit /etc/security/limits.conf and add the following lines,
nobody soft nofile 100000
nobody hard nofile 500000
Now apply the sysctl configuration using the following command .
# sysctl -p
Etiquetas:
How-To
Enable Cache in cPnginx Servers
You can enable cache in cPnginx. This will decrease the server load. But enabling cache will show the website updates slowly only. To enable cache please do the following,
1) Modify the file /etc/cpnginx/vhost.conf as follows,
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
proxy_buffers 16 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
proxy_connect_timeout 30s;
proxy_cache my-cache;
proxy_cache_valid 200 302 60m;
proxy_cache_valid 404 1m;
proxy_cache_key “$scheme$host$request_uri”;
2) Edit nginx.conf as follows,
1) Modify the file /etc/cpnginx/vhost.conf as follows,
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
proxy_buffers 16 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
proxy_connect_timeout 30s;
proxy_cache my-cache;
proxy_cache_valid 200 302 60m;
proxy_cache_valid 404 1m;
proxy_cache_key “$scheme$host$request_uri”;
2) Edit nginx.conf as follows,
Etiquetas:
How-To
Nginx And HttpRealIpModule
This module is already enabled by default in cPnginx version 6.0 or higher . You may simply need to add the module setting in nginx.conf as follows,
set_real_ip_from $firewall_ip1;
set_real_ip_from $firewall_ip2;
real_ip_header X-Real-IP;
You may also edit /usr/local/apache/conf/mod_rpaf.conf with the following
RPAFheader X-Real-IP
RPAFheader X-Forwarded-For
These sttings are required for cloudflare clients.
That’s it !!
set_real_ip_from $firewall_ip1;
set_real_ip_from $firewall_ip2;
real_ip_header X-Real-IP;
You may also edit /usr/local/apache/conf/mod_rpaf.conf with the following
RPAFheader X-Real-IP
RPAFheader X-Forwarded-For
These sttings are required for cloudflare clients.
That’s it !!
Etiquetas:
How-To
Wednesday, September 4, 2013
How to reset default SSH port for cPanel/WHM
How to change/reset default SSH port on your cPanel servers?
Did you forget SSH port and try to reset it via WHM, Use the following SSH configuration settings on WHM.
Login to your WHM on a non secure port that is : 2086
For example : http://serverip:2086
Then browse the URL to reset the SSH configuration settings :
http://serverip:2086/scripts2/doautofixer?autofix=safesshrestart
After running the script, the default port 22 will reset on your cpanel SSH configuration. You can login SSH and reset it.
That’s it !!
Did you forget SSH port and try to reset it via WHM, Use the following SSH configuration settings on WHM.
Login to your WHM on a non secure port that is : 2086
For example : http://serverip:2086
Then browse the URL to reset the SSH configuration settings :
http://serverip:2086/scripts2/doautofixer?autofix=safesshrestart
After running the script, the default port 22 will reset on your cpanel SSH configuration. You can login SSH and reset it.
That’s it !!
Etiquetas:
Control Panel,
cPanel/WHM
How to Backup and Restore Individual cPanel Account via SSH
Backing up your hosting account is very necessary for your business to survive on Internet. Whether it is a small or large business, you must backup all of your data regularly at least once a week. cPanel provides some great ready made scripts which will help you make your tasks more easy. Commands such as pkgacct is basically used for backing up cpanel web hosting accounts and restorepkg for restoring cpanel accounts via the SSH or command line interface.
How to create backup of Individual cPanel Account via SSH?
Step 1: Log-in to the SSH as Root user.
Step 2: Enter the following command string on the command line interface:
/scripts/pkgacct username
[Note: The account backup will be created in the current directory you are in.]
How to Restore the Individual cPanel Account via SSH?
Step 1: To restore the cPanel account backups, enter the following command
/scripts/restorepkg username
[Note: In order to restore the data, you need to be in the directory where the backup file is stored.]
How to create backup of Individual cPanel Account via SSH?
Step 1: Log-in to the SSH as Root user.
Step 2: Enter the following command string on the command line interface:
/scripts/pkgacct username
[Note: The account backup will be created in the current directory you are in.]
How to Restore the Individual cPanel Account via SSH?
Step 1: To restore the cPanel account backups, enter the following command
/scripts/restorepkg username
[Note: In order to restore the data, you need to be in the directory where the backup file is stored.]
How to Reset MySQL root Password
To provide multi user access to number of databases a relation database management system is been developed that runs on a server and called as MySQL. MySQL is developed under GNU General Public License and its source code is available under its defined terms. MySQL is a popular choice of database for use in web applications and it performs really well with cPanel hosting accounts to store data of any websites. And suppose if you have forget the MySQL root password and you are not able to access your mysql service then you need to reset the password of MySQL root user by using following steps which are as follows,
Steps to Reset MySQL root Password :
1)root@server [~]/etc/init.d/mysqld stop
2)Start to MySQL server without password:
root@server [~]mysqld_safe –skip-grant-tables &
3) root@server [~] mysql
After that you can get the mysql prompt then run the following command
4)mysql >use mysql;
5)mysql >update user set password=PASSWORD(“NEWPASSWORD”) where User=’root’;
6)mysql > quit
7)root@server [~]/etc/init.d/mysqld stoproot@server [~]/etc/init.d/mysqld start
Now you can access your mysql service by using
[root@server ~]#mysql -u root -p
Steps to Reset MySQL root Password :
1)root@server [~]/etc/init.d/mysqld stop
2)Start to MySQL server without password:
root@server [~]mysqld_safe –skip-grant-tables &
3) root@server [~] mysql
After that you can get the mysql prompt then run the following command
4)mysql >use mysql;
5)mysql >update user set password=PASSWORD(“NEWPASSWORD”) where User=’root’;
6)mysql > quit
7)root@server [~]/etc/init.d/mysqld stoproot@server [~]/etc/init.d/mysqld start
Now you can access your mysql service by using
[root@server ~]#mysql -u root -p
Etiquetas:
How-To
How to ban or block an IP address from visiting my website?
You can make use of .htaccess files in order to block an IP
address from accessing your website. A .htaccess is a kind of
configuration file that can be used from things like setting
password-protected directories, preventing the display of file
extensions to, of course, restricting access based on IP.
To ban an IP address from accessing your website, create a .htaccess file within your root directory (usually public_html or www) and add the following configuration in the file:
order allow,deny
deny from 127.0.0.1
allow from all
How to Upgrade mod_pagespeed
Inorder to upgrade the mod_pagespeed module, you must first download the latest version and make use of the command “yum localinstall mod-pagespeed-*.rpm” for the purpose of installing http://code.google.com/speed/page-speed/download.html
Use the below commands to upgrade the package :
sudo yum update
sudo /etc/init.d/httpd restart
Etiquetas:
cPanel/WHM,
How-To,
Installation
Simple PHP Script for RBL Checking
It’s useful for ISP’s and email service providers to run occasional
RBL checks against their IPs to know when they are being blacklisted by
populate CBL services. I’ve written a simple script that utilizes the
DNSBL pear library to check against common blacklists, when given a list
of IPs in a file.
First, you need to download or install the NET_DNSBL pear module. (Command: pear install NET_DNSBL)
This checks your IP's to a RBL listing so you can take appropriate action against abusers.
First, you need to download or install the NET_DNSBL pear module. (Command: pear install NET_DNSBL)
<?php
require_once('Net/DNSBL.php');
$iplist = file("/path/to/iplist");
foreach ($iplist as $ip){
$dnsbl = new Net_DNSBL();
$dnsbl->setBlacklists(array(
'sbl-xbl.spamhaus.org',
'dnsbl.sorbs.net',
'bl.spamcop.net',
'dnsbl-1.uceprotect.net',
'dnsbl-2.uceprotect.net',
'dnsbl-3.uceprotect.net',
'isps.spamblocked.com',
'zen.spamhaus.org'
));
if ($dnsbl->isListed($ip)) {
echo "IP $ip is blacklisted!\n";
}
else {
echo "IP $ip not listed\n";
}
}
?>
This checks your IP's to a RBL listing so you can take appropriate action against abusers.
Etiquetas:
How-To
Wednesday, July 17, 2013
Exim: remove mails in queue from a particular sender
“spams”, its one of the major issue that a sys admin has to deal with throughout his job. First you need to find the user who is generating it. You can get it from the mail headers. Once you find the user, disable the script that was responsible for spams, but it may have already kept thousands(may be lacks) of mails in the exim queue waiting for its chance to get delivered. To delete these mails one by one is impossible. In a cPanel server having exim mail, you can use the following command to delete mails in the current queue generated by that particular user only.
SSH into the server
exiqgrep -i -f user@domain.com | xargs exim -Mrm
-i print messages id
-f from address
-Mrm remove mails
Remove mails to a particular sender in the queue :-
exiqgrep -i -t user@domain.com | xargs exim -Mrm
-t to address
SSH into the server
exiqgrep -i -f user@domain.com | xargs exim -Mrm
-i print messages id
-f from address
-Mrm remove mails
Remove mails to a particular sender in the queue :-
exiqgrep -i -t user@domain.com | xargs exim -Mrm
-t to address
Etiquetas:
How-To
Tuesday, July 16, 2013
How to enable DKIM in cPanel server.
DomainKeys Identified Mail (DKIM) lets an organization take responsibility for a message while it is in transit and one can use this to prevent from getting blacklisted by the free email providers like Yahoo, MSN and Google. DKIM can increase the mail authenticity.
cPanel does not have an interface to enable DKIM like we have for SPF and Domain Keys. cPanel is still working on it for getting it implemented. However we can enable it manually by following the below steps.
Check if exim is compiled with DKIM support enabled.
Generate the SSL keys
openssl rsa -in dkim.key -out dkim.public -pubout -outform PEM
You will find two keys, dkim.key & dkim.public
cPanel does not have an interface to enable DKIM like we have for SPF and Domain Keys. cPanel is still working on it for getting it implemented. However we can enable it manually by following the below steps.
Check if exim is compiled with DKIM support enabled.
root@server # /usr/sbin/exim -dd 2>&1 | grep Experimental_DKIM
Support for: crypteq iconv() IPv6 PAM Perl OpenSSL Content_Scanning Old_Demime Experimental_SPF Experimental_SRS
Experimental_DomainKeys Experimental_DKIM
Generate the SSL keys
cd /usr/local/cpanel/etc/eximopenssl genrsa -out dkim.key 1024
openssl rsa -in dkim.key -out dkim.public -pubout -outform PEM
You will find two keys, dkim.key & dkim.public
Monday, July 8, 2013
How do I reset Kloxo (LxAdmin) Admin Password
To reset lxadmin, you can do through SSH with just two commands:
cd /usr/local/lxlabs/lxadmin/httpdocslphp.exe ../bin/common/resetpassword.php master password
How to disable direct root login in your server
1. SSH into your server as root user.
2. Open the ssh configuration file using an editor like Vi
$ vi /etc/ssh/sshd_config
3. Find the line
Protocol 2, 1
4. Uncomment it and change it to look like
Protocol 2
5. Next, find the line
PermitRootLogin yes
6. Uncomment it and make it look like PermitRootLogin no
7. Save the file Ctrl+X then Y then enter
8. Now you can restart SSH
/etc/rc.d/init.d/sshd restart
Now, no one will be able to login to root with out first loggin in as admin and 'su -' to root, and you will be forcing the use of a more secure protocol. Just make sure you remember both passwords!
***If you're using cPanel make sure you add your admin user to the 'wheel' group so that you will be able to 'su -' to root, otherwise you may lock yourself out of root.***
2. Open the ssh configuration file using an editor like Vi
$ vi /etc/ssh/sshd_config
3. Find the line
Protocol 2, 1
4. Uncomment it and change it to look like
Protocol 2
5. Next, find the line
PermitRootLogin yes
6. Uncomment it and make it look like PermitRootLogin no
7. Save the file Ctrl+X then Y then enter
8. Now you can restart SSH
/etc/rc.d/init.d/sshd restart
Now, no one will be able to login to root with out first loggin in as admin and 'su -' to root, and you will be forcing the use of a more secure protocol. Just make sure you remember both passwords!
***If you're using cPanel make sure you add your admin user to the 'wheel' group so that you will be able to 'su -' to root, otherwise you may lock yourself out of root.***
Etiquetas:
How-To
How do I check what version of CentOS
To obtain the version of CentOS your server is running, from command line issue the following:
cat /etc/*release*
Installation of FFMPEG, Mencoder, GPAC for 3gp video conversion server for CentOS
# install dependencies
yum -y install gcc gmake make libcpp libgcc libstdc++ gcc4 gcc4-c++ gcc4-gfortran subversion patch zlib-devel
yum -y install gcc gmake make libcpp libgcc libstdc++ gcc4 gcc4-c++ gcc4-gfortran subversion patch zlib-devel
# get encoding software
cd /usr/local/src
cd /usr/local/src
wget http://www3.mplayerhq.hu/MPlayer/releases/codecs/essential-20071007.tar.bz2
wget http://ftp.penguin.cz/pub/users/utx/amr/amrnb-7.0.0.2.tar.bz2
wget http://downloads.sourceforge.net/gpac/gpac-0.4.5.tar.gz
tar xf gpac-0.4.5.tar.gz
tar jxvf amrnb-7.0.0.2.tar.bz2
tar jxvf essential-20071007.tar.bz2
wget http://ftp.penguin.cz/pub/users/utx/amr/amrnb-7.0.0.2.tar.bz2
wget http://downloads.sourceforge.net/gpac/gpac-0.4.5.tar.gz
tar xf gpac-0.4.5.tar.gz
tar jxvf amrnb-7.0.0.2.tar.bz2
tar jxvf essential-20071007.tar.bz2
svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer
svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer
# install encoding software
mkdir /usr/local/lib/codecs/
mv /usr/local/src/essential-20071007/* /usr/local/lib/codecs/
chmod -R 755 /usr/local/lib/codecs/
mkdir /usr/local/src/tmp
chmod 777 /usr/local/src/tmp
export TMPDIR=/usr/local/src/tmp
mv /usr/local/src/essential-20071007/* /usr/local/lib/codecs/
chmod -R 755 /usr/local/lib/codecs/
mkdir /usr/local/src/tmp
chmod 777 /usr/local/src/tmp
export TMPDIR=/usr/local/src/tmp
cd /usr/local/src/amrnb-7.0.0.2
./configure
make && make install
./configure
make && make install
cd /usr/local/src/mplayer
svn update
./configure
make && make install
svn update
./configure
make && make install
cd /usr/local/src/ffmpeg/
./configure –enable-libamr-nb –disable-mmx –enable-nonfree
make && make install
./configure –enable-libamr-nb –disable-mmx –enable-nonfree
make && make install
cd ./gpac
./configure
make && make install
./configure
make && make install
# update library links
echo /usr/local/lib > /etc/ld.so.conf.d/ffmpeg.conf
ldconfig
echo /usr/local/lib > /etc/ld.so.conf.d/ffmpeg.conf
ldconfig
Etiquetas:
How-To,
Installation
How do I enable mod_rewrite in Apache2 on Debian?
Enabling mod_rewrite in apache2 is a simple procedure.
a2enmod rewrite
Edit /etc/apache2/sites-available/000-default or it may be called /etc/apache2/sites-available/default
and change the following line:
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
change it to:
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
allow from all
Lastly, restart apache2:
/etc/init.d/apache2 restart
How to install ZPanel on ubuntu 12.04 x86_64
1) Ensure that you're using a server or VPS with a clean install of
Ubuntu 12.04. This tutorial will focus on using Neosurge's VPS hosting
solutions.
Etiquetas:
How-To,
Installation,
Linux,
zPanel
Tuesday, July 2, 2013
Installing DomainKeys and SPF Records
DomainKeys (DKIM) and SPF records are becoming a common, and annoying, demand among email providers, mainly Yahoo and Hotmail. In short, both are methods of email authentication designed to verify email integrity, by linking a sender to a specific server or hostname. In other words, DomainKeys and SPF records specify what servers can send email on behalf of a domain name.
You’ll want DomainKeys and SPF records if your users have trouble sending email to certain providers, or they are having issues with spoofed (forged) email. CPanel currently allows two easy ways for you or your users to set up email verification. This is supported at least from cPanel 11.18 onward.
User-Level:
You can enable the “Email Authentication” feature in WHM ~> Feature Manager, which will enable the Email Authentication icon in the users’ cPanels where they can create DomainKeys and SPF records for their domain(s).
Root-level:
You’ll want DomainKeys and SPF records if your users have trouble sending email to certain providers, or they are having issues with spoofed (forged) email. CPanel currently allows two easy ways for you or your users to set up email verification. This is supported at least from cPanel 11.18 onward.
User-Level:
You can enable the “Email Authentication” feature in WHM ~> Feature Manager, which will enable the Email Authentication icon in the users’ cPanels where they can create DomainKeys and SPF records for their domain(s).
Root-level:
Etiquetas:
How-To
How to do Directadmin to Directadmin Migration
The directadmin to directadmin migration is easy.
1) Set the value skip_domains_in_backups=1 in /usr/local/directadmin/conf/directadmin.conf . This will skip coping home folder during backup creation.
2) Do to admin panel Admin Tools -> Admin Backup/Transfer , And select all users and run a backup now .This will take all accounts backups under the folder /home/admin/admin_backups.
3) Now login to the admin panel of the new server and go to Admin Tools -> Admin Backup/Transfer , then select the “restore backups “. Chose all the backups files and click the submit.
4) Monitor the new server and wait for finishing the restore. You can check the top comand and or use pstree. See if the comamnd dataskq completed or not. Also check the home folders.
5) After finishing it simply rsync the home folders.
1) Set the value skip_domains_in_backups=1 in /usr/local/directadmin/conf/directadmin.conf . This will skip coping home folder during backup creation.
2) Do to admin panel Admin Tools -> Admin Backup/Transfer , And select all users and run a backup now .This will take all accounts backups under the folder /home/admin/admin_backups.
3) Now login to the admin panel of the new server and go to Admin Tools -> Admin Backup/Transfer , then select the “restore backups “. Chose all the backups files and click the submit.
4) Monitor the new server and wait for finishing the restore. You can check the top comand and or use pstree. See if the comamnd dataskq completed or not. Also check the home folders.
5) After finishing it simply rsync the home folders.
Etiquetas:
Direct-Admin,
How-To
Nginx And DDOS Protection
cPnginx and Danginx can use to protect the HTTP DDOS as follows,
Edit the file /etc/sysctl.conf and increase the openfile limits. Add the following line,
fs.file-max = 700000
Edit /etc/security/limits.conf and add the following lines,
nobody soft nofile 100000
nobody hard nofile 500000
Now apply the sysctl configuration using the following command .
# sysctl -p
Now edit the /usr/local/nginx/conf/nginx.conf file and add the following line.
worker_rlimit_nofile 50000;
1) Add the following sysctl parameters,
—————
net.ipv4.tcp_syncookies = 1
# source validation / reversed path
net.ipv4.conf.all.rp_filter = 1
net.ipv4.conf.default.rp_filter = 1
kernel.pid_max = 65536
net.ipv4.ip_local_port_range = 9000 65000
————–
2) Use the RateLimit module , http://wiki.nginx.org/HttpLimitZoneModule It must be placed inside http block
—————–
limit_zone slimits $binary_remote_addr 10m;
limit_conn slimits 10;
——————
3) You can also use the following too,
—————-
limit_req_zone $binary_remote_addr zone=slimitss:10m rate=1r/s;
limit_req zone=slimitss burst=10;
Edit the file /etc/sysctl.conf and increase the openfile limits. Add the following line,
fs.file-max = 700000
Edit /etc/security/limits.conf and add the following lines,
nobody soft nofile 100000
nobody hard nofile 500000
Now apply the sysctl configuration using the following command .
# sysctl -p
Now edit the /usr/local/nginx/conf/nginx.conf file and add the following line.
worker_rlimit_nofile 50000;
1) Add the following sysctl parameters,
—————
net.ipv4.tcp_syncookies = 1
# source validation / reversed path
net.ipv4.conf.all.rp_filter = 1
net.ipv4.conf.default.rp_filter = 1
kernel.pid_max = 65536
net.ipv4.ip_local_port_range = 9000 65000
————–
2) Use the RateLimit module , http://wiki.nginx.org/HttpLimitZoneModule It must be placed inside http block
—————–
limit_zone slimits $binary_remote_addr 10m;
limit_conn slimits 10;
——————
3) You can also use the following too,
—————-
limit_req_zone $binary_remote_addr zone=slimitss:10m rate=1r/s;
limit_req zone=slimitss burst=10;
Etiquetas:
How-To
How to reset litespeed admin password
Go to the below path
run the below command
It will show below output
It will ask for the username type (admin) and password you want to set
/usr/local/lsws/admin/misc
run the below command
sh admpass.sh
It will show below output
Please specify the user name of administrator.
This is the user name required to login the administration Web interface.
User name [admin]: admin
Please specify the administrator’s password.
This is the password required to login the administration Web interface.
Password:
Retype password:
Administrator’s username/password is updated successfully!
It will ask for the username type (admin) and password you want to set
Etiquetas:
cPanel/WHM
How to install WatchMySQL Plugin in WHM
Installation
Go to the below path
Remove the file or take the backup
Download watchmysql plugin using the below link
Change the ownership of that file
Change permission of the file.
Configuration
Before you run the script you must first configure it. Use edit to open the watchmysql script and set the options.
#Sets the maximum concurrent connections per MySQL user.
#Who to tell about this user... (email)
#Kill Abuser's MySQL Connections (0 = no, 1 = yes)
#MySQL polling in seconds (600 = 10 minutes)
Running
To start this script simply run the following command
If you want the script to start when the system boots you need to add the above line to /etc/rc.local
Go to the below path
cd /sbin
Remove the file or take the backup
rm -f watchmysql
Download watchmysql plugin using the below link
wget http://www.ndchost.com/cpanel-whm/scripts/watchmysql/download.php
Change the ownership of that file
chown root.root watchmysql
Change permission of the file.
chmod 0750 watchmysql
Configuration
Before you run the script you must first configure it. Use edit to open the watchmysql script and set the options.
#Sets the maximum concurrent connections per MySQL user.
my $max_concurrent_connections = '15';
#Who to tell about this user... (email)
my $warning_email = 'your@email.address';
#Kill Abuser's MySQL Connections (0 = no, 1 = yes)
my $kill_user = '0';
#MySQL polling in seconds (600 = 10 minutes)
my $check_interval = '600';
Running
To start this script simply run the following command
/sbin/watchmysql &
If you want the script to start when the system boots you need to add the above line to /etc/rc.local
Etiquetas:
cPanel/WHM,
How-To,
WHM Plugins
rpm command cheat sheet for Linux
rpm is a powerful Package Manager for Red Hat, Suse and Fedora Linux.
It can be used to build, install, query, verify, update, and
remove/erase individual software packages. A Package consists of an
archive of files, and package information, including name, version, and
description:
Syntax | Description | Example(s) |
rpm -ivh {rpm-file} | Install the package | rpm -ivh mozilla-mail-1.7.5-17.i586.rpm rpm -ivh –test mozilla-mail-1.7.5-17.i586.rpm |
rpm -Uvh {rpm-file} | Upgrade package | rpm -Uvh mozilla-mail-1.7.6-12.i586.rpm rpm -Uvh –test mozilla-mail-1.7.6-12.i586.rpm |
rpm -ev {package} | Erase/remove/ an installed package | rpm -ev mozilla-mail |
rpm -ev –nodeps {package} | Erase/remove/ an installed package without checking for dependencies | rpm -ev –nodeps mozilla-mail |
rpm -qa | Display list all installed packages | rpm -qa rpm -qa | less |
rpm -qi {package} | Display installed information along with package version and short description | rpm -qi mozilla-mail |
rpm -qf {/path/to/file} | Find out what package a file belongs to i.e. find what package owns the file | rpm -qf /etc/passwd rpm -qf /bin/bash |
rpm -qc {pacakge-name} | Display list of configuration file(s) for a package | rpm -qc httpd |
rpm -qcf {/path/to/file} | Display list of configuration files for a command | rpm -qcf /usr/X11R6/bin/xeyes |
rpm -qa –last | Display list of all recently installed RPMs | rpm -qa –last rpm -qa –last | less |
rpm -qpR {.rpm-file} rpm -qR {package} |
Find out what dependencies a rpm file has | rpm -qpR mediawiki-1.4rc1-4.i586.rpm rpm -qR bash |
Etiquetas:
Installation
How to Install EAccelerator, IonCube, Zend Optimizer, SourceGuardian, and SuHosin outside of EasyApache
You can use /scripts/phpextensionmgr to install or uninstall these modules!
If you wanted to install Zend Optimizer use the below command.
/scripts/phpextensionmgr list
Available Extensions:
EAccelerator
IonCubeLoader
Zendopt
SourceGuardian
PHPSuHosin
If you wanted to install Zend Optimizer use the below command.
/scripts/phpextensionmgr install Zendopt
Installing Zendopt
Determining PHP version
Installing Zend Optimizer binary
Activating Zend Optimizer in /usr/local/lib/php.ini
Zend Optimizer activated
Skipping install to /usr/local/php4, missing php.ini
Etiquetas:
cPanel/WHM,
How-To,
PHP/Mysql
Site is working fine with apache but giving 403 error with litespeed
=================================
Error 403: Forbidden
You don’t have permissions to access this page. This usually means one of the following:
===================================
Go to the clients account for which you are getting the error message.
Create a .htaccess file and enter the below lines into it.
save and quit
Error 403: Forbidden
You don’t have permissions to access this page. This usually means one of the following:
===================================
Go to the clients account for which you are getting the error message.
Create a .htaccess file and enter the below lines into it.
SecFilterEngine Off
SecFilterScanPOST Off
save and quit
Etiquetas:
Apache,
Control Panel
How to reset ssh port through WHM
Login to your WHM using 2086
And then browse the below URL:
It will prompt for server password insert it and it will show that port is reset to default(22)
And then browse the below URL:
http://serverip:2086/scripts2/doautofixer?autofix=safesshrestart
It will prompt for server password insert it and it will show that port is reset to default(22)
Etiquetas:
Control Panel,
cPanel/WHM
How to install varnish through yum
Download varnish rpm using the below link
run the below command
rpm –nosignature -i http://repo.varnish-cache.org/redhat/el5/noarch/varnish-release-2.1-2.noarch.rpm
run the below command
yum install varnish
Etiquetas:
cPanel/WHM,
Installation
How to uninstall varnish manually
Go to the folder where you have downloaded the tar file.
Go inside apachebooster folder
Provide the below permission to the file.
Run the below command to uninstall it.
Go inside apachebooster folder
Provide the below permission to the file.
chmod 777 uninstall
Run the below command to uninstall it.
sh uninstall
Etiquetas:
Installation
How to Install varnish manually
Download the tar file from the below link
untar it using the below command.
go into extracted directory
then fire the below command
wget http://prajith.in/downloads/apachebooster.tar.gz
untar it using the below command.
tar -xvf apachebooster.tar.gz
go into extracted directory
cd apachebooster
then fire the below command
sh install.sh
Etiquetas:
cPanel/WHM,
Installation
Install Mhash in php 5.3+ in cPanel Centos Linux servers
The php-mhash installation in php 5.3 is very easy. Please use the following steps to install it
1) Download the latest mhash from http://mhash.sourceforge.net/ and install it as follows,
1) Download the latest mhash from http://mhash.sourceforge.net/ and install it as follows,
2) Now add it to the loader configuration in /etc/ld.so.conf.d/mhash.conf# tar -xzf mhash-0.9.9.9.tar.gz # ./configure --prefix=/opt/mhash # make # make install
3) Now edit the file /var/cpanel/easy/apache/rawopts/all_php5 and add the following line/opt/mhash/lib
4) Finally compile the php using the following command--with-mhash=/opt/mhash
You can test the mhash by creating a phpinfo page in your website document root.# /scripts/easyapache --build
Etiquetas:
How-To
How to convert directadmin to SUPHP
Conversion to SUPHP in directadmin is easy. You may please proceed with the following steps
1) Set the following custom build options
This easy steps will help you to conversion your directadmin to suphp and fix the permission issues in your scripts.
1) Set the following custom build options
2)Now compile apache and php using the following commands/build set php5_cgi yes ./build set php5_cli no
3) Now need to fix the roundcube , squirrelmail and phpmyadmin permissions as follows,./build all d ./build rewrite_confs
4) Now need to fix the ownership and permission of files and dirs as follows,./build roundcube ./build squirrelmail ./build phpmyadmin
# for i in `/bin/ls /usr/local/directadmin/data/users/` ; do chown -R $i.$i /home/$i/domains/* ; echo $i ;done # for i in `/bin/ls /usr/local/directadmin/data/users/` ; do find /home/$i/domains/ -type f -exec chmod 644 {} \; ; echo $i ;done # for i in `/bin/ls /usr/local/directadmin/data/users/` ; do find /home/$i/domains/ -type d -exec chmod 755 {} \; ; echo $i
This easy steps will help you to conversion your directadmin to suphp and fix the permission issues in your scripts.
Etiquetas:
Direct-Admin,
How-To
CSF Directadmin Issue Permission denied [User:admin UID:501]- Solved
This is a simple permission issue in directadmin. The CSF in
directadmin is running a setuid program. So it simply need to enable
the setuid permission for the root user in this program. You may
need to look into the following file ,
Now you need to enable the “S” bit as follows,# ls -al /usr/local/directadmin/plugins/csf/exec/csf -rwxr-xr-x 1 root root 8112 Jun 23 10:37 /usr/local/directadmin/plugins/csf/exec/csf
Now login to the directadmin as admin user and check the CSF page. It must work.# chmod 4755 /usr/local/directadmin/plugins/csf/exec/csf # ll /usr/local/directadmin/plugins/csf/exec/csf -rwsr-xr-x 1 root root 8112 Jun 23 10:37 /usr/local/directadmin/plugins/csf/exec/csf
Etiquetas:
Direct-Admin,
How-To
How to install mod_evasive in cPanel server
Please follow the procedure given below to install and configure mod_evasive in cPanel server with apache 2.2.
Download the latest source file from http://www.zdziarski.com
Download the latest source file from http://www.zdziarski.com
# cd /usr/local/src/ # wget /blog/wp-content/uploads/2010/02/mod_evasive_1.10.1.tar.gz # tar -xvzf mod_evasive_1.10.1.tar.gz # cd mod_evasive/ # /usr/local/apache/bin/apxs -cia mod_evasive20.c
Now create a file named /usr/local/apache/conf/mod_evasive.conf and add the following lines
Now include the above file inside /usr/local/apache/conf/includes/pre_main_global.conf# cat /usr/local/apache/conf/mod_evasive.conf LoadModule evasive20_module modules/mod_evasive20.so <IfModule mod_evasive20.c> DOSHashTableSize 3097 DOSPageCount 2 DOSSiteCount 50 DOSPageInterval 1 DOSSiteInterval 1 DOSBlockingPeriod 10 </IfModule>
Now rebuild httpd.confInclude "/usr/local/apache/conf/mod_evasive.conf"
Now restart apache/scripts/rebuildhttpdconf
/scripts/restartsrv httpd
Etiquetas:
.htaccess,
cPanel/WHM,
Installation,
SSH
Monday, July 1, 2013
How Do I Restore A MySQL Database?
To restore a MySQL database please follow the below steps:
- Login to your control panel www.yourdomain.com/cpanel
- Click on 'Backups' in 'Site Management'
- Click on 'Browse' to locate the Database you want to restore then click 'Upload'
It may take a while to upload your .sql and populate the database so a broadband connection would help. This will overwrite the database that you currently have up.
- Login to your control panel www.yourdomain.com/cpanel
- Click on 'Backups' in 'Site Management'
- Click on 'Browse' to locate the Database you want to restore then click 'Upload'
It may take a while to upload your .sql and populate the database so a broadband connection would help. This will overwrite the database that you currently have up.
Etiquetas:
How-To
Reset Bandwidth Usage In WHM/cPanel
If you run cPanel on your VPS or Dedicated Server and want to reset bandwidth for a particular user or domain then:
WHM/cPanel should now show 0 for the user/domain in Account Information >> View Bandwidth Usage
- ssh to your server
- cd /var/cpanel/bandwidth.cache/
- vi domainname.com and/or vi username
- replace contents with 0
- save and quit
WHM/cPanel should now show 0 for the user/domain in Account Information >> View Bandwidth Usage
Etiquetas:
cPanel/WHM,
How-To
How To Reset A Kloxo Or LxAdmin Password From SSH
When your VPS is installed by us with Kloxo or LXadmin the password will 'admin' and the username 'admin' too.
Note: if you reinstall yourself it will also be 'admin'.
If you still can't login then:
Note: if you reinstall yourself it will also be 'admin'.
If you still can't login then:
1) Login via SSH
2) cd /usr/local/lxlabs/kloxo/httpdocs
or
2) cd /usr/local/lxlabs/lxadmin/httpdocs
3) /usr/bin/lphp.exe ../bin/common/resetpassword.php master NEWPASSWORD
How to force redirection to HTTPS
To force visitors to use HTTPS to access your site via yor SSL
certificate is to add the following to the top of a .htaccess file:
RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
Etiquetas:
.htaccess
CentOS - Hostname Change
There are 4 steps in a hostname change, luckily all the steps are easy.
Sysconfig/Network
Open the /etc/sysconfig/network file with your favorite text editor. Modify the HOSTNAME= value to match your FQDN host name.# sudo nano /etc/sysconfig/network
HOSTNAME=myserver.domain.com
Hosts File
Change the host that is associated to your main IPaddress for your server, this is for internal networking (found at /etc/hosts):Run Hostname
The 'hostname' command will let you change the hostname on the server that the commandline remembers, but it will not actively update all programs that are running under the old hostname.Restart Networking
At this point all the necessary changes that needed to be made have been made, you will want to restart networking on your server to make sure that changes will be persistent on reboot:# /etc/init.d/network restart
Sunday, June 30, 2013
How to enable SSH/Shell Access in cPanel
Linux distros include SSH client software by default or it can be easily installed with
'apt-get install openssh-client' or 'yum install openssh-clients' depending on your package manager.
To access your shell with SSH from Linux perform the following steps:
1. Login to cPanel and go to Security > SSH/Shell Access to generate SSH key pair.
2. Click Manage SSH Keys > Generate a New Key. You should use a password to protect the key. You will be asked the password each time you use the key.
3. In Public Keys section click 'Manage Authorization' and 'Authorize'
4. In Private Keys section click Vew/Download then download the key (id_dsa or id_rsa) to your PC.
5. Save it to ~/.ssh directory on your linux machine under a meaningful name to not overwrite your existing keys for example id_dsa.myjavahost
6. Now make sure permissions are correct on the key (one time task) and connect (you will be prompted for the password you setup in step #2):
mypc:~$ chmod 600 .ssh/id_dsa.myjavahost
mypc:~$ ssh -p1033 -i .ssh/id_dsa.myjavahost yourusername@yourservername
Enter passphrase for key '.ssh/id_dsa.myjavahost':
You should be logged in now.
'apt-get install openssh-client' or 'yum install openssh-clients' depending on your package manager.
To access your shell with SSH from Linux perform the following steps:
1. Login to cPanel and go to Security > SSH/Shell Access to generate SSH key pair.
2. Click Manage SSH Keys > Generate a New Key. You should use a password to protect the key. You will be asked the password each time you use the key.
3. In Public Keys section click 'Manage Authorization' and 'Authorize'
4. In Private Keys section click Vew/Download then download the key (id_dsa or id_rsa) to your PC.
5. Save it to ~/.ssh directory on your linux machine under a meaningful name to not overwrite your existing keys for example id_dsa.myjavahost
6. Now make sure permissions are correct on the key (one time task) and connect (you will be prompted for the password you setup in step #2):
mypc:~$ chmod 600 .ssh/id_dsa.myjavahost
mypc:~$ ssh -p1033 -i .ssh/id_dsa.myjavahost yourusername@yourservername
Enter passphrase for key '.ssh/id_dsa.myjavahost':
You should be logged in now.
Thursday, June 20, 2013
How To Create Nagios Plugins With Ruby on CentOS 6
Ruby is a popular programming language that allows you to quickly create scripts and install additional libraries (Gems).
We have previously covered how to install Nagios monitoring server on CentOS 6.
This time, we will expand on this idea and create Nagios plugins using Ruby.
These plugins will be running on client servers, and be executed via NRPE.
Step 1 - Install RPMForge Repository and NRPE on client servers
Step 2 - Create your Ruby Script
We have previously covered how to install Nagios monitoring server on CentOS 6.
This time, we will expand on this idea and create Nagios plugins using Ruby.
These plugins will be running on client servers, and be executed via NRPE.
Step 1 - Install RPMForge Repository and NRPE on client servers
rpm -ivh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
yum -y install ruby nagios-nrpe
useradd nrpe && chkconfig nrpe on
Step 2 - Create your Ruby Script
Etiquetas:
How-To,
Installation
How to Install zPanel on CentOS 6
About zPanel
zPanel is a php-based free control panel for windows, mac, and linux servers. The program runs on top of an Apache, MySQL, PHP stack on whichever platform is used. zPanel should be installed on a fresh server, as all of the programs that zPanel requires are set up automatically through their installation process.
Step One—Download the Zipped Installer File.
LOG INTO YOUR SERVER AS THE ROOT USER, do not use sudo.
- Download the correct installer for your system:
64 Bit Installerwget http://www.zvps.co.uk/sites/default/files/downloads/centos-6-3/package/installer-x86_64-install.sh.x.tar.gz
Or32 Bit Installerwget http://www.zvps.co.uk/sites/default/files/downloads/centos-6-3/package/installer-x86-install.sh.x.tar.gz
- Unzip the tarball
Etiquetas:
How-To,
Installation,
zPanel
Monday, June 17, 2013
How to Install mod_cloudflare on a cPanel Server
When using CloudFlare, all of the hits to your web server will come from a CloudFlare IP address. To retrieve the actual IP address from the visitor, you must install mod_cloudflare.
How to Install mod_cloudflare
Connect to your server through SSH and log in as root.
Change directory to /usr/local/src :
How to Install mod_cloudflare
Connect to your server through SSH and log in as root.
Change directory to /usr/local/src :
cd /usr/local/srcGet the source code for mod_cloudflare:
wget --no-check-certificate https://raw.github.com/cloudflare/mod_cloudflare/master/mod_cloudflare.cUse the Apache Extension Tool to build and install mod_cloudflare:
CloudFlare-Tools/master/mod_cloudflare.c
apxs -a -i -c mod_cloudflare.cRestart the Apache HTTP daemon:
service httpd restartUpdate the Apache configuration data files:
/usr/local/cpanel/bin/apache_conf_distiller --updateThat’s it! From now on, Apache will log the visitors’ IP addresses instead of the CloudFlare IP’s.
Etiquetas:
Apache,
cloudflare,
cPanel/WHM,
How-To,
website speed
Saturday, June 15, 2013
Free cPanel Nginx automated installer Plugin
nginx is open-source, high-performance HTTP server and reverse proxy, as well as an IMAP/POP3 proxy server. nginxcp cPanel nginx automated installer Plugin which Turbo boost your cPanel server with low resources usage.
Nginx Admin Install instruction:
cd /usr/local/src
wget http://nginxcp.com/latest/nginxadmin.tar
tar xf nginxadmin.tar
cd publicnginx
./nginxinstaller install
Nginx Admin Uninstall instruction:
cd /usr/local/src
wget http://nginxcp.com/latest/nginxadmin.tar
tar xf nginxadmin.tar
cd publicnginx
./nginxinstaller uninstall
If you get any error message “access key doesn’t exist, Go to WHM >> Cluster/Remote Access >> Setup Remote Access Key
Then click Generate New Key and then to install it.
Please visit http://nginxcp.com/ for information.
Nginx Admin Install instruction:
cd /usr/local/src
wget http://nginxcp.com/latest/nginxadmin.tar
tar xf nginxadmin.tar
cd publicnginx
./nginxinstaller install
Nginx Admin Uninstall instruction:
cd /usr/local/src
wget http://nginxcp.com/latest/nginxadmin.tar
tar xf nginxadmin.tar
cd publicnginx
./nginxinstaller uninstall
If you get any error message “access key doesn’t exist, Go to WHM >> Cluster/Remote Access >> Setup Remote Access Key
Then click Generate New Key and then to install it.
Please visit http://nginxcp.com/ for information.
Etiquetas:
cPanel/WHM,
How-To,
Installation
cPanel error mysql database size 0MB
You may see the mysql database size as zero in cPanel >> ‘Mysql Databases’ option, though the databases contains tables and data. In order to include the size of the databases while displaying disk usage in cPanel/WHM, perform either of the following steps:
1. SSH to your server as root and edit the cpanel.config file
disk_usage_include_sqldbs=0
and change to
disk_usage_include_sqldbs=1
If the parameter is not present, add it. Save the file and execute the following command:
# /scripts/update_db_cache
OR
2. Login to the WHM, goto Tweak Settings >> ‘SQL’ section and enable the following option:
When displaying disk usage in cpanel/WHM include Postgresql and MySQL.
This issue was fixed on most of times.
1. SSH to your server as root and edit the cpanel.config file
# vi /var/cpanel/cpanel.configSearch for
disk_usage_include_sqldbs=0
and change to
disk_usage_include_sqldbs=1
If the parameter is not present, add it. Save the file and execute the following command:
# /scripts/update_db_cache
OR
2. Login to the WHM, goto Tweak Settings >> ‘SQL’ section and enable the following option:
When displaying disk usage in cpanel/WHM include Postgresql and MySQL.
This issue was fixed on most of times.
Etiquetas:
cPanel/WHM
PHP script to find php shells
his is a script written by Karen Chun and published under GPL
<?php
/* lookforbadguys.php 2012-04-09
Copyright (C)2012 Karen Chun, Steven Whitney.
Initially published by http://25yearsofprogramming.com.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License (GPL)
Version 3 as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
--Purpose: iterate through server files looking for hacker code snippets, backdoor scripts,
suspicious .htaccess code, suspicious file names.
Suspicious things to search for are stored in easily modifiable lists of regular expressions.
--Tested with PHP 5.2 and 5.3. It might work with earlier versions.
--It is designed for use in either Linux or Windows.
On my system, it runs much slower in Windows.
--Not all things it finds are hacks. Not all hacks are found.
--You should also search manually for weird files (such as .php files) in your image directories,
especially if your .htaccess has redirects or was made executable.
--Some searches are commented out because they can give too many false positives.
----------
CHANGELOG:
--2011-03-08 First published
<?php
/* lookforbadguys.php 2012-04-09
Copyright (C)2012 Karen Chun, Steven Whitney.
Initially published by http://25yearsofprogramming.com.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License (GPL)
Version 3 as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
--Purpose: iterate through server files looking for hacker code snippets, backdoor scripts,
suspicious .htaccess code, suspicious file names.
Suspicious things to search for are stored in easily modifiable lists of regular expressions.
--Tested with PHP 5.2 and 5.3. It might work with earlier versions.
--It is designed for use in either Linux or Windows.
On my system, it runs much slower in Windows.
--Not all things it finds are hacks. Not all hacks are found.
--You should also search manually for weird files (such as .php files) in your image directories,
especially if your .htaccess has redirects or was made executable.
--Some searches are commented out because they can give too many false positives.
----------
CHANGELOG:
--2011-03-08 First published
Etiquetas:
PHP/Mysql
Disable SSH Direct Root Login
First you need to add new admin user
1,adduser admin
2,passwd admin
Please keep admin password
3, vi /etc/group
Make sure admin user wheel settings
wheel:x:10:root,admin
1. SSH into your server as ‘admin’ and gain root access by su
2. Copy and paste this line to edit the file for SSH logins
vi /etc/ssh/sshd_config
3. Find the line
Protocol 2, 1
4. Uncomment it and change it to look like
Protocol 2
5. Next, find the line
PermitRootLogin yes
6. Uncomment it and make it look like PermitRootLogin no
7. Save the file Ctrl+X then Y then enter
8. Now you can restart SSH
/etc/rc.d/init.d/sshd restart
1,adduser admin
2,passwd admin
Please keep admin password
3, vi /etc/group
Make sure admin user wheel settings
wheel:x:10:root,admin
1. SSH into your server as ‘admin’ and gain root access by su
2. Copy and paste this line to edit the file for SSH logins
vi /etc/ssh/sshd_config
3. Find the line
Protocol 2, 1
4. Uncomment it and change it to look like
Protocol 2
5. Next, find the line
PermitRootLogin yes
6. Uncomment it and make it look like PermitRootLogin no
7. Save the file Ctrl+X then Y then enter
8. Now you can restart SSH
/etc/rc.d/init.d/sshd restart
MySQL downgrade on cPanel server
You know downgrades are not recommended, it’s always best to stick with a newer version and work around whatever issues you have but if you really have to downgrade then this way is pretty easy and always works 99% of the time to be honest.
As always make sure you take BACKUPS of your databases and mysql directory before you continue..
Edit /var/cpanel/cpanel.config and look for the mysql-version line and edit the number to whatever version you need i.e.
mysql-version=5.5
to
mysql-version=5.1
Save it and run the following command:
/scripts/mysqlup –force
After this is done – login to your WHM control panel and run easyeapache and rebuild based on your last profile to connect everything back together.
As always make sure you take BACKUPS of your databases and mysql directory before you continue..
Edit /var/cpanel/cpanel.config and look for the mysql-version line and edit the number to whatever version you need i.e.
mysql-version=5.5
to
mysql-version=5.1
Save it and run the following command:
/scripts/mysqlup –force
After this is done – login to your WHM control panel and run easyeapache and rebuild based on your last profile to connect everything back together.
Etiquetas:
PHP/Mysql
What is Anonymous FTP and how to enable it
Anonymous FTP allows you and others that you give permission to, to access your “public_ftp” folder.
There are two options available:
1. ftp://ftp.yourdomain.com –This allows others to view, delete, upload and download files directly into your “public_ftp” folder.
2. ftp://ftp.yourdomain.com/incoming –This allows others to upload, view, delete, and download files located only within the public_ftp/incoming folder of your hosting account.
Warning: Anonymous FTP allows anyone access to a restricted area of your site. It is generally safest to not enable Anonymous FTP. If you do enable it, you are responsible for the bandwidth and space used.
To set Anonymous FTP access:
Click on the Ftp Manager button on the home page.
Click on the Anonymous FTP Controls link.
Click on the Allow anonymous access to ftp://ftp.yourdomain.com tick box or the Allow anonymous upload to ftp://ftp.yourdomain.com/incoming tick box. You must click on both tick boxes to enable uploads.
Click on the Save Settings button.
There are two options available:
1. ftp://ftp.yourdomain.com –This allows others to view, delete, upload and download files directly into your “public_ftp” folder.
2. ftp://ftp.yourdomain.com/incoming –This allows others to upload, view, delete, and download files located only within the public_ftp/incoming folder of your hosting account.
Warning: Anonymous FTP allows anyone access to a restricted area of your site. It is generally safest to not enable Anonymous FTP. If you do enable it, you are responsible for the bandwidth and space used.
To set Anonymous FTP access:
Click on the Ftp Manager button on the home page.
Click on the Anonymous FTP Controls link.
Click on the Allow anonymous access to ftp://ftp.yourdomain.com tick box or the Allow anonymous upload to ftp://ftp.yourdomain.com/incoming tick box. You must click on both tick boxes to enable uploads.
Click on the Save Settings button.
Etiquetas:
How-To
Nameserver IPs not showing in WHM
If the nameserver ips not showing in your WHM >> Main >> DNS Functions >> Nameserver IPs
In order to fix the issue you need to correct the entries for the name server’s IP in the below two files
1. You can check the entries in the /etc/nameserverips file and it should show the below output
root@server [~]# cat /etc/nameserverips
x.x.x.x=ns1.yourdomain.com
x.x.x.x=ns2.yourdomain.com
And if the entries in the above files are correct then,
2. Check the next file it should show the below output
root@server [~]# cat /var/cpanel/nameserverips.yaml
—
ns1.yourdomain.com:
x.x.x.x: 1
count: 1
zones: yourdomain.com
ns2.yourdomain.com:
x.x.x.x: 1
count: 1
zones: yourdomain.com
If the nameserver ip entries are missing in your file then make ip changes and restart named service.
Etiquetas:
cPanel/WHM,
How-To
Monday, June 10, 2013
How to install installatron cPanel/WHM
This tutorial will give you the commands to run inside SSH, this will install installatron on a cPanel/WHM dedicated or virtual private server.
Step one: wget http://data1.liquenox.com/installatron/installatron_setup.sh
Step two: chmod 755 installatron_setup.sh
Step three: ./installatron_setup.sh -f
When you now login to WHM, you should see installatron inside your plugins area, you should purchase a license from either us, or direct before you can use it to it's full potential
Etiquetas:
How-To
How to install kloxo (LXAdmin)
This will show you and give you the commands to install kloxo, also known as lxadmin.
First of all run the yum update command, simply copy and paste "yum update -y". (This will update your vps system and operating system)
Step one: wget http://download.lxlabs.com/download/kloxo/production/kloxo-install-master.sh (This will download the installation files)
Step two: sh ./kloxo-install-master.sh (This will start the install)
Step three: Reboot your vps with the command "reboot"
Once your server is back online, go to: http://your.ip:7777 (For non ssl) or http://your.ip:7778 (For ssl) use the ssl port for the first login, your default user and password will be set as admin & admin.
Then thats it, all done.
Just setup your dns zones and domains.
Etiquetas:
How-To,
Installation
How to install Webmin
Webmin is a more advanced server management control panel, offering apache, php, squid and many more.
This is used upon a virtual private server, or a dedicated server, and is an open source platform, with no charges.
Follow the commands below, to install this.
1) wget http://prdownloads.sourceforge.net/webadmin/webmin-1.510-1.noarch.rpm
2) rpm -Uvh webmin-1.510-1.noarch.rpm
Once these are complete, it should say webmin is now installed, you should then go to either your hostname or ip with the port 1000, for example http://127.0.0.1:10000, you can then login with your root information.
Etiquetas:
How-To,
Installation
Install Cloudflare cPanel
Got a API code from CloudFlare to be a Partner? But you don't know how to install it? Here is a simple to use tutorial.
log into SSH via Putty, Xshell or another Terminal
Log in as root with your password.
1.) cd /usr/local/cpanel
2.) curl https://www.cloudflare.com/downloads/cloudflare.tar.gz > cloudflare.tar.gz
3.) tar -zxf cloudflare.tar.gz
4.) ls -alh (shows you the files in the folder, look for the cloudflare-CloudFlare-CPanel- numbers/leters file)
eg: cloudflare-CloudFlare-CPanel-d03f3b8 (d03f3b8 would be the Unique ID)
5.) cd cloudflare-CloudFlare-CPanel-UNIQUEID/cloudflare/
6.) ./install_cf [API HOST KEY] mod_cf DeluxeWebs
change [API HOST KEY] with the API you got from CloudFlare. Change DeluxeWebs with your company name.
When finished installing.
7.) cd ../../
8.) rm -rf cloudflare-CloudFlare-CPanel-UNIQUEID
Etiquetas:
How-To,
Installation
Wednesday, June 5, 2013
IP remove from Brute Force Attack database by SSH
Sometimes, because of the Brute Force Attack we are unable to login to WHM if we are using correct details also. Then at that time try using below method.
Login to server via SSH.
Connect with mysql database using mysql command. It will show below output.
root@testserver [/var/log]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 172123
Server version: 5.1.65-cll MySQL Community Server (GPL)Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.mysql>
Then type show databases commands in mysql it will show all databases.
mysql> show databases;
+——————–+
| Database |
+——————–+
| information_schema |
| cphulkd |
| eximstats |
| horde |
| leechprotect |
| logaholicDB_test |
| modsec |
| mysql |
| roundcube |
+——————–+
9 rows in set (0.00 sec)
Then go to cphulkd database using below command.
mysql> use cphulkd;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -ADatabase changed
Now, it’s time to show tables.
mysql> show tables;
+——————-+
| Tables_in_cphulkd |
+——————-+
| auths |
| blacklist |
| brutes |
| good_logins |
| logins |
| report |
| whitelist |
+——————-+
7 rows in set (0.00 sec)
You can take backup of tables using below command
mysql>BACKUP TABLE `brutes` TO ‘/path/to/backup/directory’;
Run below command to check your IP is blocked in CPHulk Brute Froce database. Replace xxx.xxx.xxx.xxx with your IP
mysql> SELECT * FROM `brutes` WHERE `IP`=’xxx.xxx.xxx.xxx’;
Run below command to remove IP from database
mysql> DELETE FROM `brutes` WHERE `IP`=’xxx.xxx.xxx.xxx’;
Also, check IP in login table also by running the below command
mysql> SELECT * FROM ‘logins’ WHERE ‘IP’ =’xxx.xxx.xxx.xxx’;
Remove the IP from login table using below command.
mysql> DELETE FROM ‘logins’ WHERE ‘IP’ =’xxx.xxx.xxx.xxx’;
OR
You can use below method to clear brutes and login tables. Please note it will remove all the IP’s from database.
Now empty some tables by giving the below commands.
mysql> DELETE FROM brutes;
Query OK, 60 rows affected (0.00 sec)mysql> DELETE FROM logins;
Query OK, 34 rows affected (0.00 sec)
9 rows in set (0.00 sec)
Etiquetas:
cPanel/WHM,
PHP/Mysql
Unknown License File Version in cpanel : Failed to get a new license, or part of the update process failed
Sometime while accessing WHM, some links are giving below error.
===============================================
Unknown License File Version (has = 23, needed = 22, length=1554). This means that the system failed to get a new license, or part of the update process failed. If you are the server admin,
===============================================
To resolve this issue follow the below steps
If above commands work then it’s ok but if it is still show above error then follow the below steps
run the below command to stop cpsrvd service
then sync the files from cpanel server using below command this will fix your issue.
===============================================
Unknown License File Version (has = 23, needed = 22, length=1554). This means that the system failed to get a new license, or part of the update process failed. If you are the server admin,
===============================================
To resolve this issue follow the below steps
/usr/local/cpanel/cpkeyclt
If above commands work then it’s ok but if it is still show above error then follow the below steps
run the below command to stop cpsrvd service
/usr/local/cpanel/etc/init/stopcpsrvd
then sync the files from cpanel server using below command this will fix your issue.
/usr/local/cpanel/scripts/upcp –sync
How to Install mod_pagespeed in cpanel
Login into your server as “root” and start firing the below commands,
mod_pagespeed has a dependency that you’ll want to enable: mod_deflate (the httpd source directory (httpd-2.2.21) may vary depending on your install):
cd /usr/local/src
mkdir mod_pagespeed
cd mod_pagespeed
wget https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_x86_64.rpm
rpm2cpio mod-pagespeed-stable_current_x86_64.rpm | cpio -idmv
cp /usr/local/src/mod_pagespeed/usr/lib64/httpd/modules/mod_pagespeed.so /usr/local/apache/modules/
cp /usr/local/src/mod_pagespeed/etc/httpd/conf.d/pagespeed.conf /usr/local/apache/conf/
chmod 755 /usr/local/apache/modules/mod_pagespeed.so
mkdir /var/mod_pagespeed/{cache,files} -p
chown nobody:nobody /var/mod_pagespeed/*
mod_pagespeed has a dependency that you’ll want to enable: mod_deflate (the httpd source directory (httpd-2.2.21) may vary depending on your install):
Etiquetas:
Apache,
cPanel/WHM,
Installation
Command to check mod_pagespeed
Command to check mod_pagespeed is installed in server.
You will get below output.
curl -D http://127.0.0.1
You will get below output.
Date: Fri, 07 Sep 2012 21:51:06 GMT
Server: Apache/2.2.3 (CentOS)
X-Mod-Pagespeed: 0.10.22.4-1633
Etiquetas:
How-To
How to install magickwand in linux
First go to the path where you want to download the tar file.
Use the below link to download the magickwand tar file.
Extract the file using the below command.
Go inside the extracted folder.
Run the below commands to configure and compile it with PHP
cd /usr/local/src/
Use the below link to download the magickwand tar file.
wget http://www.magickwand.org/download/php/MagickWandForPHP-1.0.9.tar.gz
Extract the file using the below command.
tar -zxvf MagickWandForPHP-1.0.9.tar.gz
Go inside the extracted folder.
cd MagickWandForPHP-1.0.9
Run the below commands to configure and compile it with PHP
phpize
./configure
make
make install
Etiquetas:
How-To,
Installation
rpm command cheat sheet for Linux
rpm command cheat sheet for Linux
rpm is a powerful Package Manager for Red Hat, Suse and Fedora Linux. It can be used to build, install, query, verify, update, and remove/erase individual software packages. A Package consists of an archive of files, and package information, including name, version, and description:
Syntax | Description | Example(s) |
rpm -ivh {rpm-file} | Install the package | rpm -ivh mozilla-mail-1.7.5-17.i586.rpm rpm -ivh –test mozilla-mail-1.7.5-17.i586.rpm |
rpm -Uvh {rpm-file} | Upgrade package | rpm -Uvh mozilla-mail-1.7.6-12.i586.rpm rpm -Uvh –test mozilla-mail-1.7.6-12.i586.rpm |
rpm -ev {package} | Erase/remove/ an installed package | rpm -ev mozilla-mail |
rpm -ev –nodeps {package} | Erase/remove/ an installed package without checking for dependencies | rpm -ev –nodeps mozilla-mail |
rpm -qa | Display list all installed packages | rpm -qa rpm -qa | less |
rpm -qi {package} | Display installed information along with package version and short description | rpm -qi mozilla-mail |
rpm -qf {/path/to/file} | Find out what package a file belongs to i.e. find what package owns the file | rpm -qf /etc/passwd rpm -qf /bin/bash |
rpm -qc {pacakge-name} | Display list of configuration file(s) for a package | rpm -qc httpd |
rpm -qcf {/path/to/file} | Display list of configuration files for a command | rpm -qcf /usr/X11R6/bin/xeyes |
rpm -qa –last | Display list of all recently installed RPMs | rpm -qa –last rpm -qa –last | less |
rpm -qpR {.rpm-file} rpm -qR {package} | Find out what dependencies a rpm file has | rpm -qpR mediawiki-1.4rc1-4.i586.rpm rpm -qR bash |
Etiquetas:
Installation
Subscribe to:
Posts (Atom)