Issue:
How to change the ownership of multiple accounts under /home via SSH? The option in WHM is a bit tedious.
Solution :
To change the ownership of all accounts to the respective user.user :
cd /home
ls -al | grep root
for i in `ls /var/cpanel/users/`; do chown $i:$i /home/$i ; done
for i in `ls /var/cpanel/users/`; do chown -R $i:$i /home/$i/* ; done
Then change the ownership of the individual public_htmls to their respective user.nobody:
for i in `ls /var/cpanel/users/`; do chown $i:nobody /home/$i/public_html ; done
Change the permissions for public_htmls to 750:
for i in `ls /var/cpanel/users/`; do chmod 750 /home/$i/public_html ; done
Fix the permissions for mail to work fine:
/scripts/mailperm
Fix the ownership of /home:
chown root.root /home
Changing multiple account ownerships via SSH
Posted by Mayur's BLOG 0 comments
semget: No space left on device
Posted by Mayur's BLOG 0 comments
Whenever you start Apache, it keeps crashing with error "semget: No space left on device".
# tail /etc/httpd/logs/error_log
semget: No space left on device
semget: No space left on device
[Wed Sep 12 10:54:27 2007] [warn] pid file /usr/local/apache/logs/httpd.pid overwritten
-- Unclean shutdown of previous Apache run? semget: No space left on device
[Wed Sep 12 10:56:27 2007] [warn] pid file /usr/local/apache/logs/httpd.pid overwritten
-- Unclean shutdown of previous Apache run? semget: No space left on device
[Wed Sep 12 10:58:27 2007] [warn] pid file /usr/local/apache/logs/httpd.pid overwritten
-- Unclean shutdown of previous Apache run? semget: No space left on device
[Wed Sep 12 11:00:27 2007] [warn] pid file /usr/local/apache/logs/httpd.pid overwritten
-- Unclean shutdown of previous Apache run? semget: No space left on device
If you have similar problem as mine above + if your disk space is nowhere near/above 100% + /var/messages and /usr/local/apache/logs/error_log shows no clue about this problem + any files in /etc/httpd/logs/ and /etc/httpd/domlogs nowhere near/above 2GB in size, its most probably semaphore problem. Use the following script to cure your Apache.
#!/bin/bash
ipcs -s | grep nobody | perl -e 'while (
@a=split(/\s+/); print `ipcrm sem $a[1]`}'
/scripts/restartsrv httpd
Script how to:
- SSH as root to your CPanel server
- Go to root dir
# cd /root
- Create a httpdsemclean.sh blank file
# pico httpdsemclean.sh
- Write above script
- Save
Ctrl + O
- Exit pico
Ctrl + X
- Chmod httpdsemclean.sh to 777
# chmod 777 httpdsemclean.sh
- Execute the script
./httpdsemclean.sh
If all goes fine, you'll see something like this:
...
resource(s) deleted
resource(s) deleted
resource(s) deleted
resource(s) deleted
resource(s) deleted
resource(s) deleted
resource(s) deleted
resource(s) deleted
resource(s) deleted
resource(s) deleted
Waiting for httpd to restart..............finished.
httpd started ok
PS: Do this at your own risk, we do not guarantee this will work on all CPanel servers!
sshd has failed, please contact the sysadmin
Posted by Mayur's BLOG 1 comments
If you have changed the shell default Port 22 on a cPanel powered server , restarting sshd from the WHM will fail. You have to ssh to the server and issue the following command to restart sshd…
* /sbin/service sshd restart
To, temporarily, reset your shell port back to 22, run the following command from the Address field in browser:
SERVER_MAIN_IP:2087/scripts2/doautofixer?autofix=safesshrestart
Now, you should be able to access shell, and you need to restart sshd at the prompt using the command mentioned above
How To Install RED5 Server on Centos 5.3
Posted by Mayur's BLOG 1 comments
In this how to i will describe how to install RED5 server on Centos 5.3. This how to can be used to install RED5 server on Centos 4 and Fedora 8 – 11 as well. RED5 is open source flash server written in java supports streaming audio/video, recording client streams, shared objects, live stream publishing etc.
1) Download and Install Java
RED5 server depends on Java. CentOS 5.3 comes with OpenJDK 1.6 and install it using yum.
yum -y install java-1.6.0-openjdk java-1.6.0-openjdk-devel
2) Download and Install Ant (Apache Project)
Ant will need to compile RED5 server code. Ant comes in binary form, so just download and install it in /usr/local directory.
cd /usr/src
wget http://opensource.become.com/apache/ant/binaries/apache-ant-1.7.1-bin.tar.gz
tar zxvf apache-ant-1.7.1-bin.tar.gz
mv apache-ant-1.7.1/ /usr/local/ant
3) Export Variables for Ant and Java
export ANT_HOME=/usr/local/ant
export JAVA_HOME=/usr/lib/jvm/java
export PATH=$PATH:/usr/local/ant/bin
export CLASSPATH=.:$JAVA_HOME/lib/classes.zip
Also export these variables in /etc/bashrc to become available for every user login or for any terminal opens.
echo ‘export ANT_HOME=/usr/local/ant’ >> /etc/bashrc
echo ‘export JAVA_HOME=/usr/lib/jvm/java’ >> /etc/bashrc
echo ‘export PATH=$PATH:/usr/local/ant/bin’ >> /etc/bashrc
echo ‘export CLASSPATH=.:$JAVA_HOME/lib/classes.zip’ >> /etc/bashrc
4) Download and Install RED5 Server
Here the latest version available for RED5 is 0.7 on site but download from google code using svn as the tarball of 0.7 on site is missing some of the files.
cd /usr/src
svn checkout http://red5.googlecode.com/svn/java/server/trunk/ red5
mv red5 /usr/local/
cd /usr/local/red5
ant prepare
ant dist
you will see a ton of lines, but you should get at last
BUILD SUCCESSFUL
that’s mean its install and now copy the conf directory from dist/ and test the red5 installation.
cp -r dist/conf .
./red5.sh
If it shows Installer service created in the last then everything is fine here, press ctrl+c and move to next step to create init script.
5) Init Script
Now we will create init script for red5 to start, stop and restart easily.
vi /etc/init.d/red5
download http://www.sohailriaz.com/downloads/red5.txt and copy / paste code in it. The init script code also be viewed below.
#!/bin/sh
# For RedHat and cousins:
# chkconfig: 2345 85 85
# description: Red5 flash streaming server
# processname: red5
PROG=red5
RED5_HOME=/usr/local/red5
DAEMON=$RED5_HOME/$PROG.sh
PIDFILE=/var/run/$PROG.pid
# Source function library
. /etc/rc.d/init.d/functions
[ -r /etc/sysconfig/red5 ] && . /etc/sysconfig/red5
RETVAL=0
case “$1″ in
start)
echo -n $”Starting $PROG: ”
cd $RED5_HOME
$DAEMON >/dev/null 2>/dev/null &
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
echo $! > $PIDFILE
touch /var/lock/subsys/$PROG
fi
[ $RETVAL -eq 0 ] && success $”$PROG startup” || failure $”$PROG startup”
echo
;;
stop)
echo -n $”Shutting down $PROG: ”
killproc -p $PIDFILE
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$PROG
;;
restart)
$0 stop
$0 start
;;
status)
status $PROG -p $PIDFILE
RETVAL=$?
;;
*)
echo $”Usage: $0 {start|stop|restart|status}”
RETVAL=1
esac
exit $RETVAL
Now start the service
/etc/init.d/red5 start
check status
/etc/init.d/red5 status
red5 (pid XXXXX) is running…
again you can do stop, restart.
Error:- Missing Dependency: perl(URI) >= 1.17 is needed by package subversion-1.4.2-4.el5_3.1.i386
Posted by Mayur's BLOG 0 comments
While installing subversion on my CentOS 5.2 64bit OS i got this error
yum install subversion
Missing Dependency: perl(URI) >= 1.17 is needed by package subversion-1.4.2-4.el5_3.1.i386
I google the error and found the solution.
*
Fistly i download perl(URI) which is greater than 1.17. I downloaded perl(URI) 1.35 using the following command
wget http://yum.trixbox.org/centos/5/RPMS/perl-URI-1.35-3.noarch.rpm
*
Then i install the perl package by using following command
rpm -i perl-URI-1.35-3.noarch.rpm
*
Then i install the subversion by using following command
yum install subversion
Now subversion is working fine on my server.
Posted by Mayur's BLOG 0 comments
Here I am specifying the steps which I used to configure remote backups through NFS.
Task - Configure backup for virtuzzo on backup server.
First, you have to make the appropriate directories available to nfs by "exporting" them. On the remote server, edit the /etc/exports file to expose the directories you need to the hosts that need to access them. See the man page for exports to find out all your options, but here's a simple example from my setup:
Code:
# /etc/exports
/backup 192.168.1.0(rw,no_root_squash,async)
/backup2 192.168.1.1(rw,no_root_squash,async)
The /etc/exports file must contain a directory, (in this example the directory being exported is /home), as well as the networks (or hosts) the file system is exported to.
In this case it's exported a range of hosts in the network 192.168.1.0. Alternately, it could be exported to a single host using the configuration:
Then go to virtozzo and mount the destination as given below:
[root@server1]# mount -t nfs 192.168.1.0:/backup2 /vz/backups
To check if it is mounted or not you can use showmount -e or mount command
Then write /etc/fstab as given below:
198.168.0.1:/backup2 /vz/backup nfs rsize=1024,wsize=1024,noauto 0 0
Then restart nfs and portmap on Virtuzzo server
[root@server1]# /etc/init.d/portmap restart
[root@server1]# /etc/init.d/nfs restart
Then go to backup server and check if its mounted on this server as well, you can use to check it showmount -e or mount command
If everything is ok, fire the command to effect the changes of /etc/exports:
[root@backup01 backup2]# exportfs -r
and restart both services on this server as well:
[root@server1]# /etc/init.d/portmap restart
[root@server1]# /etc/init.d/nfs restart
That's it, I got it worked. If you have any problem please email me at mayur.c24@gmail.com
Enjoy
How to remove the blocked ip using iptables
Posted by Mayur's BLOG 0 comments
- First check that ip is blocked or not
- iptables –L –n | grep
DROP all -- 125.99.10.123 216.240.157.91
- to unblock the ip give the command
iptables -D INPUT -s 125.99.10.123 -d 216.240.157.91 -j DROP
Now the ip is unblocked.
Fantastico shows error 'You cannot install more than one script in the root directory of a domain'
Posted by Mayur's BLOG 0 comments
In order to solve this issue you should follow these steps:
1. Log in cPanel and click on File Manager;
2. Navigate to .fantasticodata in your Home Directory;
3. Delete the file installed_in_root.php.
This will ensure there is no Fantastico information remaining from previous installations.
If you have problems with your Fantastico, ask your host for assistance.
- Mayur
Named rndc.key error when starting
Posted by Mayur's BLOG 0 comments
When trying to restart named process after making modifications may end up in a corrupt rndc.key key and the error will show like this:
Sep 12 03:30:54 server named[23683]: loading configuration: bad base64 encoding
Sep 12 03:30:54 server named[23683]: exiting (due to fatal error)
A simple explanation to this is that the key got modified somehow might me some bug.
What to do about this? Well it is simple just check the /etc/rndc.conf file and copy the key from there(you will see the key in the first lines of the file) and replace the key that it is in /etc/rndc.key file and restart named process.
# service named restart
Stopping named: [ OK ]
Starting named: [ OK ]
WHM locked out – Brute Force Error
Posted by Mayur's BLOG 0 comments
cPHulk Brute Force Protection prevents malicious forces from trying to access your server’s services by guessing the login password for that service. BUT sometimes it becomes troublesome when you are accessing the cPanel with incorrect password and cPanel assuming you as attacker blocks you with below message :
—————————————————————————————
This account is currently locked out because a brute force attempt was detected. Please wait 10 minutes and try again. Attempting to login again will only increase this delay. If you frequently experience this problem, we recommend having your username changed to something less generic.
—————————————————————————————
To get out of such situation you can disable cphulkd protection :
login via ssh and disable cphulkd using the command below.
root@HOST [~]# /usr/local/cpanel/etc/init/stopcphulkd
This should allow you to login to WHM and double check your cphulk settings.
You can view IP addresses that have been blocked via the WHM interface: WHM -> Security -> Security Center -> cPHulk Brute Force Protection in the Brutes table. On that screen, you can also customize brute force protection settings.
Then log into your WHM >> Security Center >> cPHulk Brute Force Protection >> Flush DB
Make Sure to restart cphulkd protection from SSH, simply fire the following command
root@HOST [~]# /usr/local/cpanel/etc/init/startcphulkd
Well the other way to this is to remove the IP’s blocked by cPHulk from its database .
ssh to the server login as root and type the following at the prompt
[root@server:] mysql
mysql> use cphulkd;
mysql>BACKUP TABLE brutes TO ‘/path/to/backup/directory’;
mysql> SELECT * FROM brutes WHERE `IP`=’xxx.xxx.xxx.xxx’;
mysql> DELETE FROM brutes WHERE `IP`=’xxx.xxx.xxx.xxx’;
mysql>quit
Installing PDFLib on PHP 5
Posted by Mayur's BLOG 3 comments
PDFlib was removed awhile back for PHP5 because the newer versions have different licenses and we wanted to avoid any possible problems. The PHP4 version is still old so it's available in EasyApache, but of course I don't recommend PHP4 since it's not supported by the PHP developers anymore.
So if you want to install it, it will have to be outside of EasyApache. Here's how you could do it:
# wget http://www.pdflib.com/binaries/PDFlib/704/PDFlib-Lite-7.0.4p4.tar.gz
# tar -zxvf PDFlib-Lite-7.0.4p4.tar.gz
# cd PDFlib-Lite-7.0.4p4
# ./configure --without-java
# make && make install
Then build PHP with pdflib support.
# echo '--with-pdflib' >> '/var/cpanel/easy/apache/rawopts/all_php5'
# /scripts/easyapache --build
Finally, make sure pdflib is enabled as an extension in php.ini; add:
extension=pdf.so
to /usr/local/lib/php.ini and restart apache. Then it will show up. I have already done this for you as a courtesy
Thats it EnjoyWink
How to install Zend Optimizer on Plesk or on any plain server?
Posted by Mayur's BLOG 0 comments
Here are the most simple steps to install ZendOptimizer-3.0.1 on Plesk:
cd /usr/local/src
wget http://www.eth0.us/files/ZendOptimizer-3.0.1-linux-glibc21-i386.tar.gz
tar -zxf ZendOptimizer-3.0.1-linux-glibc21-i386.tar.gz
cd ZendOptimizer-3.0.1-linux-glibc21-i386
./install
Make sure that above lines are exist in /etc/php.ini
zend.ini section looks like this, [Zend] zend_extension_manager.optimizer=/usr/local/Zend/lib/Optimizer-3.3.0 zend_extension_manager.optimizer_ts=/usr/local/Zend/lib/Optimizer_TS-3.3.0 zend_optimizer.version=3.3.0a zend_extension=/usr/local/Zend/lib/ZendExtensionManager.so zend_extension_ts=/usr/local/Zend/lib/ZendExtensionManager_TS.so |
/sbin/service httpd restart |
[root@VPS Hosting ~]# php -v PHP 5.1.6 (cli) (built: May 9 2007 11:29:06) Copyright (c) 1997-2006 The PHP Group Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies with the ionCube PHP Loader v3.1.28, Copyright (c) 2002-2007, by ionCube Ltd., and with Zend Extension Manager v1.2.2, Copyright (c) 2003-2007, by Zend Technologies with Zend Optimizer v3.3.0, Copyright (c) 1998-2007, by Zend Technologies [root@VPS Hosting ~]# |
Enjoy
R=central_filter T=**bypassed**
Posted by Mayur's BLOG 0 comments
Recently I got very interesting issue and it took very long time to figure our. The problem was I was able to send/receive email to other accounts but not able to send/receive to my own account means test@test.com to test@test.com. Here is what I was getting in error logs (Cpanel server).
gin:test@test.com S=789 id=63311.122.252.239.20.1239477600.squirrel@test.com
2009-04-11 14:20:00 1LsikC-00037z-NP => /dev/null
R=central_filter T=**bypassed**
Then here is what I found in cpanel forums:
central_filter refers to the email filters you've set up in cPanel - stored in /etc/vfilters/
Then I renamed my domain name files in /etc/vfilters/ and I got this fixed, hope this will help you
Enjoy
R=virtual_user_spam T=virtual_userdelivery_spam
Posted by Mayur's BLOG 0 comments
If you are not able to receive emails and getting the errors " R=virtual_user_spam T=virtual_userdelivery_spam" in error logs then simply disable the spamassasin and check, your issue should be fixed.
Enjoy
Complile PHP with imap on directadmin server
Posted by Mayur's BLOG 1 comments
Trying to add --with-imap to your configure.php5 ?
and getting this error?
configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing
Solution (worked for me, this was a dovecot machine):
# yum install libc-client
# yum install libc-client-devel
Then add following lines in
nano /usr/local/directadmin/custombuild/configure/ap2/configure.php5
--with-imap=/usr/lib/dovecot/imap \
--with-imap-ssl \
to: configure.php5
# cd /usr/local/directadmin/custombuild/configure/ap2
# ./build php y
Tada!
Fantastico Issues
Posted by Mayur's BLOG 0 comments
First of all here are the steps to install Fantastico
If the Fantastico install option is not available, you will need to manually download Fantastico onto your VPS.
- Connect to your VPS using an SSH connection.
- Log in as the Administrator user.
- Change to the proper cgi folder using the following command:
cd /usr/local/cpanel/whostmgr/docroot/cgi
- Download the Fantastico install file using the following command:
wget http://www.netenberg.com/files/free/fantastico_whm_admin.tgz
- Extract the install file using the following command:
tar -xzpf fantastico_whm_admin.tgz
- Remove the install file using the following command:
rm -rf fantastico_whm_admin.tgz
- Log out of the SSH connection.
- Log out and log back into cPanel in a web browser.
- From the menu, under Plugins, click Fantastico De Luxe WHM Admin
- (located atthe bottom).
- Continue the install using the steps above.
Recently I got too many issue while installing fantastico. Here is one of them. If you get the message "you have not installed fantastico yet" even after installing it then the issue is probably with wget version. Here is the steps to update wget:
Login as a root in ssh and fire the following commands:
For 32-bit:
rpm -qa wget ;
wget ftp://ftp.funet.fi/pub/mirrors/ftp.redhat.com/pub/
fedora/linux/core/5/i386/os/Fedora/RPMS/
wget-1.10.2-3.2.1.i386.rpm
chattr -ia /usr/bin/wget
rpm -e wget ;
rpm -ivh --force wget-1.10.2-3.2.1.i386.rpm ;
rpm -qa wget ;
For 64-bit:
Leaving your OS default wget installed and install a fresh copy for Fantastico at /usr/local/bin/wget
cd /usr/local/bin/
wget http://ftp.gnu.org/gnu/wget/wget-latest.tar.gz
tar xfz wget-latest.tar.gz
cd wget-*
./configure
make
make test
make install
cd ../
rm -Rf wget-*
This will install a clean copy of wget on your server at /usr/local/bin/wget and you will just need to change the path of wget to /usr/local/bin/wget
for the errors in cpanel >> fantastico just run /scripts/makecpphp and the errors should be gone.
Thats it.
Enjoy
WGET with FTP
Posted by Mayur's BLOG 0 comments
Here are some useful commands to download data from an account which is exist on different server.
wget ftp://username:password@ftp.domainname.com * -r
For exa : wget ftp://test:celita0201@ftp.domainname.com * -r
OR
wget ftp://ftp.domainname.com/* --ftp-user=username --ftp-pass=password -r
wget ftp://ftp.domainname.com/* --ftp-user=test@domainname.com --ftp-pass=neHGyxhjr -r
Enjoy
Useful IPTABLES Commands
Posted by Mayur's BLOG 0 comments
TO OPEN OR CLOSE PORTS:
Before using commands for opening the port please make sure the specific port is already opened and what is the use of that port.
you can verify the port with
netstat -nap | grep :
1.you can open OR block TCp port with following syntax
iptables -A INPUT -p tcp –dport
iptables -A INPUT -p tcp –dport
2. You can open UDP port with
iptables -A INPUT -p udp –sport
iptables -A INPUT -p udp –sport
after that
3 service iptables save
TO allow or block IPs:
iptables -A INPUT -s <> -j ACCEPT
iptables -A INPUT -s <> -j DROP - to block the IP
Make sure to save IPtables if you did changes in IPtables
Usefull Options
Either long or short options are allowed.
--append -A chain Append to chain
--delete -D chain Delete matching rule from chain
--delete -D chain rulenum
Delete rule rulenum (1 = first) from chain
--insert -I chain [rulenum]
Insert in chain as rulenum (default 1=first)
--replace -R chain rulenum
Replace rule rulenum (1 = first) in chain
--list -L [chain] List the rules in a chain or all chains
--flush -F [chain] Delete all rules in chain or all chains
--zero -Z [chain] Zero counters in chain or all chains
--new -N chain Create a new user-defined chain
--delete-chain
-X [chain] Delete a user-defined chain
--policy -P chain target
Change policy on chain to target
service iptables save - To save IPtables
service iptables restart - To restart the IPtables firewall.
Enjoy
Shorthand at the Linux Command Prompt
Posted by Mayur's BLOG 0 comments
Some of these are specific to the bash shell. I have not experimented enough with other shells to know which are common to all shells. See also the ``Bash Reference Card'', SSC (2000), available online.
* / - root directory
* ./ - current directory
* ./command_name - run a command in the current directory when the current directory is not on the path
* ../ - parent directory
* ~ - home directory
* $ - typical prompt when logged in as ordinary user
* # - typical prompt when logged in as root or superuser
* ! - repeat specified command
* !! - repeat previous command
* ^^ - repeat previous command with substitution
* & - run a program in background mode
* [Tab][Tab] - prints a list of all available commands. This is just an example of autocomplete with no restriction on the first letter.
* x[Tab][Tab] - prints a list of all available completions for a command, where the beginning is ``x''
* [Alt][Ctrl][F1] - switch to the first virtual text console
* [Alt][Ctrl][Fn] - switch to the nth virtual text console. Typically, there are six on a Linux PC system.
* [Alt][Ctrl][F7] - switch to the first GUI console, if there is one running. If the graphical console freezes, one can switch to a nongraphical console, kill the process that is giving problems, and switch back to the graphical console using this shortcut.
* [ArrowUp] - scroll through the command history (in bash)
* [Shift][PageUp] - scroll terminal output up. This also works at the login prompt, so you can scroll through your boot messages.
* [Shift][PageDown] - scroll terminal output down
* [Ctrl][Alt][+] - switch to next X server resolution (if the server is set up for more than one resolution)
* [Ctrl][Alt][-] - change to previous X server resolution
* [Ctrl][Alt][BkSpc] - kill the current X server. Used when normal exit is not possible.
* [Ctrl][Alt][Del] - shut down the system and reboot
* [Ctrl]c - kill the current process
* [Ctrl]d - logout from the current terminal
* [Ctrl]s - stop transfer to current terminal
* [Ctrl]q - resume transfer to current terminal. This should be tried if the terminal stops responding.
* [Ctrl]z - send current process to the background
* reset - restore a terminal to its default settings
* [Leftmousebutton] - Hold down left mouse button and drag to highlight text. Releasing the button copies the region to the text buffer under X and (if gpm is installed) in console mode.
* [Middlemousebutton] - Copies text from the text buffer and inserts it at the cursor location. With a two-button mouse, click on both buttons simultaneously. It is necessary for three-button emulation to be enabled, either under gpm or in XF86Config.
Enjoy
How to Set Maximum Emails Per Hour for Particular Domain
Posted by Mayur's BLOG 2 comments
Its quite well known to all that in server's WHM, there is an option that allows you to set the Maximum amount of emails a domain can send per hour, which is a great way of reducing spam/mass emailing. This feature is located in the Server Configuration option, under Tweak Settings option, under the emails listing. The option looks like as follows:
The maximum each domain can send out per hour (0 is unlimited)
[root@server ~]#vi /var/cpanel/maxemailsperhour
Yes its possible, though its NOT ALLOWED and never been done on Shared Hosting and Reseller Hosting.
However, it's possible to customize such setting on VPS hosting/Semi-dedicated hosting/Dedicated hosting ...!
Here we go for the same....
Make sure you login as root in server, then run the following command which will open a blank text editor, with only the following entered inside of it:
[root@server ~]# vi /var/cpanel/maxemails
# If you update this file you must run /scripts/build_maxemails_config
[root@server ~]# vi /var/cpanel/maxemails
# If you update this file you must run /scripts/build_maxemails_config
emails.com=500
domain.net=1000
[root@server ~]#/scripts/build_maxemails_config
A file automatically get created under the directory [var/cpanel/maxemailsperdomain/]with the email value you've set for those particular domains.
Just to check, type the following which should return the value that you entered in the previous file.
[root@server ~]#cat /var/cpanel/maxemailsperdomain/emails.com
500
Important:: Make sure that you are not setting the number of emails for your domains to a very high value as it might blacklist your server IP address to some email service providers like Yahoo, Hotmail, AOL etc..
Enjoy
Change Linux timezone
Posted by Mayur's BLOG 0 comments
Select the method as per your Linux distribution:
If you are using Fedora / RHEL / Cent OS Linux
Type the redhat-config-date command at the command line to start the time and date properties tool.
# redhat-config-date
OR type setup and select time zone configuration (good for remote ssh text based Linux server sessiob)
# setup
Now, just follow on screen instructions to change timezone
Set timezone using /etc/localtime configuration file [any Linux distro]
Often /etc/localtime is a symlink to the file localtime or to the correct time zone file in the system time zone directory.
Generic procedure to change timezone
Change directory to /etc
# cd /etc
Create a symlink to file localtime:
# ln -sf /usr/share/zoneinfo/EST localtime
OR some distro use /usr/share/zoneinfo/dirname/zonefile format (Red hat and friends)
# ln -sf /usr/share/zoneinfo/EST localtime
OR if you want to set up it to IST (Asia/Calcutta):
# ln -sf /usr/share/zoneinfo/Asia/Calcutta localtime
Please mote that in above example you need to use directory structure i.e. if you want to set the timezone to Calcutta (India) which is located in the Asia directory you will then have to setup using as above.
Use date command to verify that your timezone is changed:
$ date
Output:
Tue Aug 27 14:46:08 EST 2006
Use of environment variable
You can use TZ environment variable to display date and time according to your timezone:
$ export TZ=America/Los_Angeles
$ date
Enjoy:)
Horde Webmail Fatal Error
Posted by Mayur's BLOG 0 comments
If you are receiving the following error code while Horde webmail login.
Error::
Horde "A fatal error has occurred Could not connect to database for SQL
SessionHandler. Details have been logged for the administrator"
NOTE: You can fix it only if you have a root user privileges which means this will be helpful for VPS , Semi-dedicated Servers and Dedicated servers.
1. Check the Horde webmail configuration file
#vi /usr/local/cpanel/base/horde/config/conf.php
$conf['sql']['hostspec'] = 'localhost';
$conf['sql']['username'] = 'horde';
$conf['sql']['password'] = '';
$conf['sql']['protocol'] = 'tcp';
$conf['sql']['database'] = 'horde';
#mysql -uhorde -p
You should obtain the Error.
"ERROR 1045 (28000): Access denied for user
'horde'@'localhost' (using password: YES)"
#mysql> grant all privileges on horde.* to horde@localhost identified by '';
Second solution is that, You can also try checking configuration file /etc/my.cnf and remove skip-innodb if its in there. Restart mysql service to ensure that the error has been fixed and Horde Webmail login works..
Another solution is to repair the table named "SessionHandler" in Horde Database from mysql command Prompt as follows.
#mysql
#mysql> use horde;
#mysql> repair table horde_sessionhandler;
Enjoy
Stats without login to cpanel
Posted by Mayur's BLOG 0 comments
Using following method you can access your webalizer stats without login to cPanel
# cd /home/
# ln -s ../tmp/webalizer stats
# chown username.username stats
# cd ../tmp
# chmod 755 ./webalizer
It will allow yourdomain.com/stats/ for viewing stats without logging in to cpanel
Its applicable for Webalizers stats only.
Enjoy
How to Check Memory Usage on Linux Servers.
Posted by Mayur's BLOG 0 comments
Memory is one of the most important resource components on a server to ensure that process run smooth and fast. Thus, the availability of physical memory for any server is very important, especially for high load web host server which runs database server such as Oracle or MySQL, which require high memory utilization for smooth running. Linux [CentOS] which is popular on cPanel and Plesk web hosting server, comes with several commands and tools to check memory usage on server
1. meminfo
"/proc/meminfo" contain all your memory usage information when you type:
cat /proc/meminfo
you will get an out of your server memory info, below is an example of meminfo.
2. Using free Command
free displays the total amount of free and used physical and swap memory in the system, as well as the buffers used by the kernel.
free -m
The command will display information about physical memory in MB.
free -m -t
Same with “free -m”, but -t switch will display a line containing the totals of physical memory and swap space.
free -m -s 10
The command will display memory status in megabytes on terminal with continuous polling delay at 10 seconds,You can specify any number for delay.
3. Using vmstat Command
vmstat reports information about processes, memory, paging, block IO, traps, and cpu activity. The command will display report based on averages since last reboot.
Syntax of vmstat
vmstat -[options] [delay count]
vmstat 10
The command will pool average system resources usage level for a sampling period of 10 seconds at interval of 10 seconds, except the first result that is averages since the last reboot.
If no delay is specified, only one report is printed with the average values since boot.
4. Using top Command
Syntax of top
top
Using top is very simple, Just type "top" at command shell [without ""], it constantly update stats page will be shown.
top -d 2
Same as "top", but "-d" used to Specifies the delay between screen updates after 2 sec.
5. Using ps Command
Syntax of ps aux
ps -aux
aux is the options for ps command to see every process on the system.
To see only the memory resources occupied by each category of processes, such as Apache httpd, MySQL mysqld or Java, use the following command:
ps aux | awk '{print $4"\t"$11}' | sort | uniq -c | awk '{print $2" "$1" "$3}' | sort -nr
Enjoy:)
How to change exim default port
Posted by Mayur's BLOG 0 comments
Well, I think there is no need to tell you that why some time we have to change default port (25) for exim so I directly come to the point instead of bla..bla..blaaaa..
For cpanel server:
You can run exim on another port by going to the 'Service Manager' in WebHost Manager and then enabling 'exim on another port' and choosing the port number.
For another servers:
Just add this first line to /etc/exim.conf and both 25 and 26 will work as smtp ports.
daemon_smtp_ports = 25 : 26
acl_smtp_rcpt = check_recipient
acl_smtp_data = check_message
Restart exim. Thats it
Enjoy:)
Cpanel Icon Missing From WHM List Accounts.
Posted by Mayur's BLOG 1 comments
Cpanel Icon Missing From WHM List Accounts.
Cause :-
Following option selected in WHM >> Tweak Settings
Disable login with root or reseller password into the users’ cPanel interface. Also disable switch account dropdown in themes with switch account feature |
You need to uncheck the following option in WHM >> Tweak Settings under System tab
Disable login with root or reseller password into the users’ cPanel interface. Also disable switch account dropdown in themes with switch account feature |
Enjoy:)
Disabling direct root login
Posted by Mayur's BLOG 0 comments
Inorder to disable direct root login on a linux server, you need to do the following thing:
1. vi /etc/ssh/sshd_config in that file make
Permitrootlogin no then save it
2. Restart sshd service
/etc/init.d/sshd restart
3. Now create a new user and set password for that user.
4. Add that user to the wheel group
vi /etc/groups // add that user to the group of wheel
5. Now logon to the server using the username and password and then do
su - and provide the root password
Inorder to work this properly you should have the following permission settings
chmod 4755 /bin/su
chmod 1700 /etc/passwd
chmod 1700 /etc/shadow
chmod 1755 /etc/groups
If there is anything wrong with this permission, you may get permission denied or incorrect password errors.
Enjoy:)
RSYNC
Posted by Mayur's BLOG 0 comments
rsync utility is used for synchronising files one of the major adavantage of rsync is that rsync can preserve permissions and ownership information, copy symbolic links, and generally is designed to intelligently handle your files
The basic syntax for rsync is simple enough -- just run
rsync [options] source destination
If you want to rsync the contents from /home/mabin/ to /var/www/html/ the command
rsync -a /home/mabin /var/www/html
Whe doing rsync there is a big meaning in the ending '/' because if I rsync /home/mabin/ then only the contents inside the folder mabin will be copied.....but if didn't used the '/' ie /home/mabin then the entire directory will be taken ..that is a directory named mabin will be created at the destination
some switches with rsync
-----------------------------
-a --> archive option, which actually combines several rsync options. It combines the recursive and copy symlinks options, preserves group and owner, and generally makes rsync suitable for making archive copies. Note that it doesn't preserve hardlinks
-H --> Copies hard link
-v --> verbose mode
-z --> Compress option, will compress the data during transfer
--delete --> For deleting the already transferred data from source (a dangerous option, try to avoid it)
--exclude=".*/" --> To avoid copying hidden files. With this option you can avoid copying any particular file( If you dont want to copy .php files then pot it like this --exclude="*.php/"
sample command for local copying
----------------------------------------
rsync -avh /home/mabin/ /var/www/html
Rsync for remote copying
------------------------------------------------------------
rsync -avhe ssh /home/user/dir/ user@remote.host.com:dir/
If you want to know how fast the transfer is going use the --progress option
rsync --progress -avhe ssh /home/user/dir/ user@remote.host.com:dir/
Enjoy:)
Roundcube installation on cPanel server
Posted by Mayur's BLOG 0 comments
1-Login to the server as root and run the following:
cd /usr/local/cpanel/base
wget http://dfn.dl.sourceforge.net/sourceforge/roundcubemail/roundcubemail-0.1.1.tar.gz
tar -zxvf roundcubemail-0.1.1.tar.gz
rm -rf roundcubemail-0.1.1.tar.gz
mv -f roundcubemail-0.1.1 roundcube
chown root.root -R roundcube
cd roundcube
chmod -R 777 temp
chmod -R 777 logs
mysql -e “CREATE DATABASE roundcube;” -pDATABASEPASSWORD
mysql -e “use roundcube; source SQL/mysql.initial.sql;” -pDATABASEPASSWORD
cd config
mv db.inc.php.dist db.inc.php
mv main.inc.php.dist main.inc.php
Note:Replace DATABASEPASSWORD with your server MySQL root password
2-Open db.inc.php with Pico
pico db.inc.php
Find this line in the file using (Ctrl+w)
$rcmail_config['db_dsnw'] = ‘mysql://roundcube:pass@localhost/roundcubemail’;
Replace the line above with the following line:
$rcmail_config['db_dsnw'] = ‘mysql://root:DATABASEPASSWORD@localhost/roundcube’;
Note:Replace DATABASEPASSWORD with MySQL server root password
save and close.
3-Open main.inc.php with pico
pico main.inc.php
find the following lines in the file and edit their values as the following:
$rcmail_config['enable_caching'] = FALSE;
$rcmail_config['default_host'] = ‘localhost’;
$rcmail_config['enable_spellcheck'] = FALSE;
Save and close
4-There are some changes need to be done in index.php file, instead of telling you what to find, add or remove, I have made a ready to made index.php file for you to use and you are done.
You can get the index.php file by running the following command lines:
cd /usr/local/cpanel/base/roundcube
wget http://www.2mhostblog.com/rc.1.1.tar
rm -f index.php
tar -xf rc.1.1.tar
rm -f rc.1.1.tar
5-Finally, restart your cpanel service
service cpanel restartEnjoy:)
Installing Subversion Using yum on CentOS 5
Posted by Mayur's BLOG 0 comments
Is is very simple, you can install it by using yum. But I found most of the time it is not as simple as we assume.
While attempting to install Subversion via yum today, I received the following error:
[root@sXXX ~]# yum install subversion
Loading “installonlyn” plugin
Setting up Install Process
Setting up repositories
extras 100% |=========================| 1.1 kB 00:00
updates 100% |=========================| 951 B 00:00
bla..bla..:)
bla..:)
bla..:)
Error: Missing Dependency: perl(URI) >= 1.17 is needed by package subversion
Steps to resolve this:
#wget http://yum.trixbox.org/centos/5/RPMS/perl-URI-1.35-3.noarch.rpm
#rpm -i perl-URI-1.35-3.noarch.rpm
#yum install subversion
That's it.
Enjoy:)
How do I enable innoDB storage engine?
Posted by Mayur's BLOG 0 comments
You can enable InnoDB by accessing your server via SSH as root ( or another account then use su or sudo to gain root access). Once that is done, check /etc/my.cnd for an entry like:
skip-inndob
If such an entry exists, remove or comment out the entry and restart MySQL.
If such an entry does not exist, then there are other problems for which we will need more information.
Once InnoDB is enabled, you can make it the default table type by specifying the following in /etc/my.cnf:
default-table-type=innodb
Enjoy:)
Setup Your Nameservers on Directadmin
Posted by Mayur's BLOG 0 comments
To setup your nameservers, simply do the following:
- Login to your DirectAdmin panel as "admin"
- Go to your IP Management section, and add two new IP addresses
- Once they are added, click the check boxes next to the two IPs that you've just submitted. Assign these IPs to "admin"
- Now go to your Reseller panel, and navigate to your Nameserver section
- On this page, create your two nameservers, generally ns1. and ns2.
- Finally, go back to your Admin panel and go to your Administrator Settings page. Set your nameservers to the ones you have just created and save your changes.
Enjoy:)
Checking the configuration of named.conf and zone files
Posted by Mayur's BLOG 0 comments
It is sometimes easy to make changes in named.conf file or in any zone files manually though the control panel has options to modify them. If the changes are being made manually, we should also make sure that the configuration as well as the zone files are not being messed up.
The bind package has utilities to check the syntax of named.conf and any zone files. We can make use of those binaries to check our modifications done to those files before reloading or restarting named service.
To check the sytax of zone file /var/named/kb.com.db for the domain kb.com,
[root@bash ~]# named-checkzone kb.com /var/named/kb.com.db
zone kb.com/IN: loaded serial 2006032401
OK
[root@ bash~]#
If everything is correct, it will show the serial number with which the zone file is loaded. Otherwise, it will give error message indicating the line number at which the error occured.
To check the syntax of named.conf file,
[root@bash ~]# named-checkconf /etc/named.conf
[root@bash~]#
You may also load the configuration of all master zones listed in named.conf at the time of checking the syntax as,
[root@bash ~]# named-checkconf -z /etc/named.conf
zone localdomain/IN: loaded serial 42
zone localhost/IN: loaded serial 42
zone 0.0.127.in-addr.arpa/IN: loaded serial 1997022700
zone 255.in-addr.arpa/IN: loaded serial 42
zone 0.in-addr.arpa/IN: loaded serial 42zone kb.com/IN: loaded serial 2006032401
[root@bash ~]#
The command will show a detailed output in case any error in named.conf file.
This way we can make sure that we are not editing the configuration file wrongly.
Enjoy:)
Script for deleting all the mails in Qmail
Posted by Mayur's BLOG 0 comments
create a file with the following statements, say frozen
service qmail stop
find /var/qmail/queue/mess -type f -exec rm {} \;
find /var/qmail/queue/info -type f -exec rm {} \;
find /var/qmail/queue/local -type f -exec rm {} \;
find /var/qmail/queue/intd -type f -exec rm {} \;
find /var/qmail/queue/todo -type f -exec rm {} \;
find /var/qmail/queue/remote -type f -exec rm {} \;
service qmail start
You may also include the directories like /var/qmail/queue/mess/bounce... etc.
2. Give executable permission to this file
chmod 755 frozen
3. Execute the script
sh frozen
Enjoy:)
Qmail error 'qmail: alert: cannot start: unable to open mutex'
Posted by Mayur's BLOG 1 comments
If an error "qmail: alert: cannot start: unable to open mutex" is encountered while starting qmail.
Proceed with the following steps to fixing the error:-
1. Check the result of tail -f /var/log/messages as well as tail -f /var/log/maillog
If you can't trace the error from log files, please run the binary from /var/qmail/bin.
[root@serv ~]#cd /var/qmail/bin
[root@serv ~]#./qmail-send
2. If the error is something like "alert: cannot start: unable to open mutex"
[root@serv ~]# touch /var/qmail/queue/lock/sendmutex
[root@serv ~]# chown qmails:qmail /var/qmail/queue/lock/sendmutex
3.Restart qmail using the command
[root@serv ~]# /etc/rc.d/init.d/qmail start
Enjoy:)
IMAP Error (Connection dropped by IMAP server)
Posted by Mayur's BLOG 1 comments
To troubleshoot the IMAP error(Inbox lock errors) while accessing mailbox via any webmail clients(Horde, SquirrelMail, NeoMail, Round Cube etc.):
The error will be shown as below,
Connection dropped by IMAP server2. cat inbox > inbox.new
ERROR: Connection dropped by IMAP server.
Query: SELECT "INBOX"
Reason Given: Unable to open this mailbox.
The error usually occurs when there is inbox.lock file in the mailbox.
Here the inbox gets locked and hence the mailbox can't be accessed and
you will get the above said error.
1. Remove the "inbox.lock" file from the particular mailbox.
Eventhough the "inbox.lock" file is deleted, it will be created when
the mailbox is accessed again. Hence after removing the file, we need
to copy the inbox to a new file name so as to fix the issue which can
be done as follows,
3. rm inbox
4. mv inbox.new inbox
5. Then fix ownership and permissions.
This fixes the issue.
Enjoy:)
Spamd Failing
Posted by Mayur's BLOG 0 comments
If you find the "spamd" failing error on an exim restart.
root@server [~]# /etc/init.d/exim restart
Shutting down exim: [ OK ]
Shutting down antirelayd: [ OK ]
Shutting down spamd: [ FAILED ]
Starting exim-26: [ OK ]
Starting exim: [ OK ]
Starting exim-smtps: [ OK ]
Starting antirelayd: [ OK ]
Then use he following steps
When disabling "spamd", the Cpanel create a file named "/etc/spamdisable" which may not get deleted on enabling the "spamd" feature again. Check the presence of the above said file.
The issue may also arise due to unavailability of the perl module "Mail::SpamAssassin" by installing the the same and on restarting the exim, the issue will be fixed.
# /scripts/perlinstaller --force Mail::SpamAssassin
#/etc/init.d/exim restart
Enjoy:)
The recipient cannot be verified. Please check all recipients of this 550 message to verify they are valid
Posted by Mayur's BLOG 0 comments
If you are receiving the following error;
PERM_FAILURE: SMTP Error (state 13): 550-"The recipient cannot be verified. Please check all recipients of this
550 message to verify they are valid."
SOLUTION:
First you need to check the corresponding Domain name in the file '/etc/valiases'.
root@f ~] cat /etc/valiases/domainname
*: username@domainname
Here 'username@domainname' indicates an added email account.
You need to change the username only instead of giving 'username@domainname'. That is;
root@f ~] cat /etc/valiases/domainname
*: username
Here the entry username (without the domain name) indicates the default account.
Then Restart the exim mail service.
root@f ~] /etc/init.d/exim restart
Enjoy:)
Configure exim to listen on additional ports.
Posted by Mayur's BLOG 0 comments
Exim is a popular Message Transfer Agent (MTA) used on Unix systems. By default Exim will be listening on port 25. To make Exim listening on other additional port, say 26, add the following line to /etc/exim.conf.
daemon_smtp_ports = 25:198:200
After this restart Exim using the following commands.
service exim restart
or
/etc/init.d/exim restart
This will make Exim to listen on ports 25 as well as 26.
Enjoy:)
Mail Error message: Error 550 – “The recipient cannot be verified”:
Posted by Mayur's BLOG 0 comments
On servers running cPanel, some times it is found that mail sent to valid users is bounced back by the mail server.
The bounce back messages will be similar to the following.
-----------------------
PERM_FAILURE: SMTP Error (state 9): 550-"The recipient cannot be verified.
Please check all recipients of this550 message to verify they are valid.
-----------------------
If the email account does indeed exist, then it is need to run the following commands to correct the issue.
/scripts/mailperm
Also check the /etc/localdomains file and verify that the domain name is present. Also verify that the DNS line in the
/var/cpanel/user/username contains the domain as well.
Enjoy:)
Configuring a Cpanel Counter
Posted by Mayur's BLOG 0 comments
A counter counts the number of visitors on your site. If you refresh the page counter will get increased by one.
Follow the steps given below to configure a Cpanel counter.
1. Go to counter option in your cpanel. Cpanel >> CGI center >> counters.
2. Click on counter radio button.
3. Edit/Reset a counter
Counter name:-> generally it is account username. It creates file with .dat extension on server.
New Count:-> Enter number from where you want to setup counter generally start from 0.
If you want to reset counter you have to edit both features and click on “select commit changes”. You are also able to view
counters preview through option preview.
4. Click on 'Make HTML', this will display a line.
5. On server go to following path
# cd /var/cpanel/Counters
Check file is created with the name countername.dat. Changes file permission to 777.
6. # vi countername.dat
Add the line which is created by clicking 'Make HTML' in cpanel to countername.dat file.
Enjoy:)
Enable quota in the server
Posted by Mayur's BLOG 0 comments
If quotas are not enabled for the partition, the following error will occur while doing a quotacheck in the server. In case of Cpanel server, /scripts/initquotas will throw the following error.
Quotas are now on
Updating Quota Files......
quotacheck: Can't find filesystem to check or filesystem not mounted with quota option.
quotacheck: Can't find filesystem to check or filesystem not mounted with quota option.
....Done
You need to follow the steps given below:
$ chmod 600 /quota.*
$ mount -o remount /
$ quotaoff -a
$ vi /etc/fstab
( open 'fstab' file and add usrquota,grpquota to the partition where you want to have quota on. That is, for example, add the entry like:
/dev/ubd0 / ext3 defaults,noatime,usrquota,grpquota 1 0 )
$ quotaon -a
Then you can execute the script successfully without any errors. You can run a quotacheck in the server. In Cpanel server, you can run
initquotas without any errors.
Enjoy:)
Round Cube Installation
Posted by Mayur's BLOG 0 comments
Remove the previous traces of Roundcube in the server.
====================
cd /usr/local/cpanel/base
rm -rf roundcube*
mysql
mysql>drop database roundcube;
====================
Before starting the installation, you need to know the root password of Mysql
====================
cd /usr/local/cpanel/base
wget http://easynews.dl.sourceforge.net/sourceforge/roundcubemail/roundcubemail-0.1beta2.1.tar.gz
tar -zxvf roundcubemail-0.1beta2.1.tar.gz
mv -f roundcubemail-0.1beta2 roundcube
cd roundcube
chmod -R 777 temp
chmod -R 777 logs
====================
Create the database. Find mysql root password from /root/.my.cnf.
Login as user, root.
====================
mysql -u root -p
Password:
mysql>CREATE DATABASE roundcube;
mysql>use roundcube;
mysql>source SQL/mysql.initial.sql;
mysql>quit
====================
Add the configuration:
====================
cd config
mv db.inc.php.dist db.inc.php
mv main.inc.php.dist main.inc.php
====================
Edit the configuration files
====================
using your text editor edit db.inc.php
Find:
$rcmail_config[’db_dsnw’] = ‘mysql://roundcube:pass@localhost/roundcubemail’;
Replace with:
$rcmail_config[’db_dsnw’] = ‘mysql://root:rootpass@localhost/roundcube’;
#vi main.inc.php
====================
Replace the corresponding root password
====================
Find:
$rcmail_config[’default_host’] = ”;
Replace with:
$rcmail_config[’default_host’] = ‘localhost’;
====================
Configure cPanel to show roundcube in the theme. X theme(default) only!!
====================
cd /usr/local/cpanel/base/roundcube/skins/default/images/
cp roundcube_logo.png /usr/local/cpanel/base/frontend/x/images/roundcube_logo.png
cp roundcube_logo.png /usr/local/cpanel/base/webmail/x/images/roundcube_logo.png
wget http://www.yourserverguide.com/Files/HGpatch-roundcube-1.0BETA2.1
patch -p0 <>
====================
If you receive a message stating: Reversed (or previously applied) patch detected! Assume -R? Please press N for No as this is because you previously installed roundcube
This will auto do all the necessary changes to roundcube and the X theme. Once the patch is executed you may now access roundcube via http://yourdomain/webmail
Enjoy:)