Friday, 29 January 2010
http://blog.arvixe.com/421-too-many-connections-8-from-this-ip-filezilla-fix/
http://blog.arvixe.com/421-too-many-connections-8-from-this-ip-filezilla-fix/
Tuesday, 26 January 2010
Yum "GLib-CRITICAL" How To Fix
Possible Solution "GLib-CRITICAL":
First try it:
# rpm -Uvh http://www.mirrorservice.org/sites/mirror.centos.org/4.6/os/i386/CentOS/RPMS/sqlite-3.3.6-2.i386.rpm http://www.mirrorservice.org/sites/mirror.centos.org/4.6/os/i386/CentOS/RPMS/sqlite-devel-3.3.6-2.i386.rpm
It should fix the problem, it worked on CentOS. If didnt, go to http://mirror.centos.org/centos/
And install or re-install the next packets:
- glib
- yum
- sqlite
- python-sqlite
- python-elementtree
- python-urlgrabber
Remember to use:
# rpm -Uvh somerpm.rpm
First try it:
# rpm -Uvh http://www.mirrorservice.org/sites/mirror.centos.org/4.6/os/i386/CentOS/RPMS/sqlite-3.3.6-2.i386.rpm http://www.mirrorservice.org/sites/mirror.centos.org/4.6/os/i386/CentOS/RPMS/sqlite-devel-3.3.6-2.i386.rpm
It should fix the problem, it worked on CentOS. If didnt, go to http://mirror.centos.org/centos/
And install or re-install the next packets:
- glib
- yum
- sqlite
- python-sqlite
- python-elementtree
- python-urlgrabber
Remember to use:
# rpm -Uvh somerpm.rpm
How to flush DNS cache in Linux / Windows / Mac
Flush dns to get a new name resolution. Also flush dns cache when you can’t access a newly registered domain name. You can simply flush your dns cache anytime to get new entry. So, Flush your dns cache now.
To flush DNS cache in Microsoft Windows (Win XP, Win ME, Win 2000, Win 98):-
- Start -> Run -> type cmd
- in command prompt, type ipconfig /flushdns
- Done! You Window DNS cache has just been flush.
How to clear DNS cache in vista.
1. Click the Microsoft Vista Start logo in the bottom left corner of the screen
2. Click All Programs
3. Click Accessories
4. RIGHT-click on Command Prompt
5. Select Run As Administrator
6. In the command window type the following and then hit enter: ipconfig /flushdns
7. You will see the following confirmation:
Windows IP Configuration
Successfully flushed the DNS Resolver Cache.
To flush the DNS cache in Linux, restart the nscd daemon:-
- To restart the nscd daemon, type /etc/rc.d/init.d/nscd restart in your terminal
- Once you run the command your linux DNS cache will flush.
To flush the DNS cache in Mac OS X:-
- type lookupd -flushcache in your terminal to flush the DNS resolver cache.
ex: bash-2.05a$ lookupd -flushcache
- Once you run the command your DNS cache (in Mac OS X) will flush.
Newer versions of MacOS X should use the following command:
type dscacheutil -flushcache
**** Flush dns to get a new name resolution. Also flush dns cache when you can’t access a newly registered domain name. You can simply flush your dns cache anytime to get new entry. So, Flush your dns cache now.
To flush DNS cache in Microsoft Windows (Win XP, Win ME, Win 2000):-
To flush the DNS cache in Linux, restart the nscd daemon:-
To flush the DNS cache in Mac OS X Leopard:-
To flush the DNS cache in Mac OS X:-
To flush DNS cache in Microsoft Windows (Win XP, Win ME, Win 2000, Win 98):-
- Start -> Run -> type cmd
- in command prompt, type ipconfig /flushdns
- Done! You Window DNS cache has just been flush.
How to clear DNS cache in vista.
1. Click the Microsoft Vista Start logo in the bottom left corner of the screen
2. Click All Programs
3. Click Accessories
4. RIGHT-click on Command Prompt
5. Select Run As Administrator
6. In the command window type the following and then hit enter: ipconfig /flushdns
7. You will see the following confirmation:
Windows IP Configuration
Successfully flushed the DNS Resolver Cache.
To flush the DNS cache in Linux, restart the nscd daemon:-
- To restart the nscd daemon, type /etc/rc.d/init.d/nscd restart in your terminal
- Once you run the command your linux DNS cache will flush.
To flush the DNS cache in Mac OS X:-
- type lookupd -flushcache in your terminal to flush the DNS resolver cache.
ex: bash-2.05a$ lookupd -flushcache
- Once you run the command your DNS cache (in Mac OS X) will flush.
Newer versions of MacOS X should use the following command:
type dscacheutil -flushcache
**** Flush dns to get a new name resolution. Also flush dns cache when you can’t access a newly registered domain name. You can simply flush your dns cache anytime to get new entry. So, Flush your dns cache now.
To flush DNS cache in Microsoft Windows (Win XP, Win ME, Win 2000):-
- Start -> Run -> type cmd
- in command prompt, type ipconfig /flushdns
- Done! You Window DNS cache has just been flush.
To flush the DNS cache in Linux, restart the nscd daemon:-
- To restart the nscd daemon, type /etc/rc.d/init.d/nscd restart in your terminal
- Once you run the command your linux DNS cache will flush.
To flush the DNS cache in Mac OS X Leopard:-
- type lookupd -flushcache in your terminal to flush the DNS resolver cache.
ex: bash-2.05a$ lookupd -flushcache
- Once you run the command your DNS cache (in Mac OS X) will flush.
To flush the DNS cache in Mac OS X:-
- type dscacheutil -flushcache in your terminal to flush the DNS resolver cache.
ex: bash-2.05a$ dscacheutil -flushcache
- Once you run the command your DNS cache (in Mac OS X Leopard) will flush.
How To Install rootcheck
"Rootcheck is an open source rootkit detection software. It scans the whole system looking for known rootkits and also for the presence of unknown rootkits and kernel level ones using anomaly detection. Rootcheck is also integrated with the OSSEC HIDS, providing a powerful host-based IDS solution. It includes log analysis, file integrity change detection and rootkit detection (all in one simple to use package). "
Download rootcheck source and install:
# wget http://www.ossec.net/rootcheck/files/rootcheck-0.7.tar.gz
# tar -xvzf rootcheck-0.7.tar.gz
# cd rootcheck-0.7
# ./install
# ./rootcheck.pl
It should be fine.
Download rootcheck source and install:
# wget http://www.ossec.net/rootcheck/files/rootcheck-0.7.tar.gz
# tar -xvzf rootcheck-0.7.tar.gz
# cd rootcheck-0.7
# ./install
# ./rootcheck.pl
It should be fine.
Monday, 25 January 2010
How to change date and time zone in php on plesk server
If your php script is not showing correct date and time then it means your script is using date and time zone configured on your server.
If you want to set your own date and time zone for your domain then it can be done in a very simple manner.
You will need to create php.ini in document root of your domain.
nano php.ini
and enter following line.
save and exit from file.
Now create phpininfo page and open it in browser and you will see that date and time zone hve been enabled.
If you want to set your own date and time zone for your domain then it can be done in a very simple manner.
You will need to create php.ini in document root of your domain.
nano php.ini
and enter following line.
date.timezone =Asia/Jakarta
save and exit from file.
Now create phpininfo page and open it in browser and you will see that date and time zone hve been enabled.
Friday, 22 January 2010
How to upgrade MySQL 5.0 to MySQL 5.1 in a cPanel server
A similar request came to us two years back when we had to upgrade MySQL version 4.0 to MySQL 5.0. We are listing here the same approach for the current needs of upgrading MySQL 5.0 to 5.1
File responsible for the MySQL version is /var/cpanel/cpanel.config
Open it, find the variable mysql-version and edit the value to read mysql-version=5.1
And finally run
This should upgrade your MySQL version to MySQL 5.1. For better understanding of the process behind, /scripts/mysqlup, go through the code and browse the URL http://httpupdate.cpanel.net/mysqlinstall/
File responsible for the MySQL version is /var/cpanel/cpanel.config
Open it, find the variable mysql-version and edit the value to read mysql-version=5.1
And finally run
# /scripts/mysqlup
This should upgrade your MySQL version to MySQL 5.1. For better understanding of the process behind, /scripts/mysqlup, go through the code and browse the URL http://httpupdate.cpanel.net/mysqlinstall/
How do I reset the root mysql pass, lxadmin created ?
# cd /usr/local/lxlabs/lxadmin/httpdocs/
# lphp.exe ../bin/common/misc/reset-mysql-root-password.phps
Password protect Parent and Allow subdirectory using .htaccess
To password protect a directory use the following entries in the .htaccess in the directory
To create .htpasswd file use the following command
htpasswd -c .htpasswd
You will be prompted for password . Once it is done, the file will be created.
Now the directory is password protected.
Allow Subdirectory
The restrictions imposed on a parent directory will be applicable to the subdirectory too. To override this we need to specify it in .htaccess in the subdirectory. To disable password proptection on subdirectory , add the following in .htaccess
AuthUserFile /path/to/.htpasswd
AuthName "This is Hasten secret area"
AuthType Basic
require valid-user
To create .htpasswd file use the following command
htpasswd -c .htpasswd
You will be prompted for password . Once it is done, the file will be created.
Now the directory is password protected.
Allow Subdirectory
The restrictions imposed on a parent directory will be applicable to the subdirectory too. To override this we need to specify it in .htaccess in the subdirectory. To disable password proptection on subdirectory , add the following in .htaccess
Allow from all
Satisfy Any
How to recompile Kernel?
Kernel Recompilation
Compiling custom kernel has its own advantages and disadvantages. It helps to optimize the kernel to your environment (hardware and usage patterns). I shall try to guide you through Kernel recompilation process.
Step 1:
Download the kernel source
cd /usr/local/src
wget
Note: Replace x.y.z with actual version number.
Step 2:
Extract the source file
Step 3:
Patching the Kernel
If you are requested to apply any patches , follow these steps
a) Move the downloaded kernel patch to the
b) Extract the patch file
c) Patch the kernel source using the extracted patch file
cd /usr/local/src/
Now the Kernel Source is patched against known vulnerabilities.
Step 4:
Configuration
If you are trying to upgrade the Kernel of already running server , it is always better use the existing configuration. To do this follow these steps
#uname -a
Linux Server1 2.6.18-164.el5 #1 SMP Thu Sep 3 03:28:30 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux
# cd /boot
There you can see different configuration files as given below
#ls
config-2.6.18-128.el5 initrd-2.6.18-128.el5.img message
config-2.6.18-164.el5 initrd-2.6.18-164.el5.img quota.user*
identify the configuration file corresponding to the version of OS installed , In our case it is config-2.6.18-164.el5 . We are copying this file to the downloaded kernel source to use it during configuration.
#cp -p config-2.6.18-164.el5 /usr/local/src/linux-x.y.z/.config
# make clean
# make mrproper
You have to select different options as per your need. If you intended to use the existing configuration ,specify the path to the file ( .config in this case) by selecting the option
“Load an Alternative configuration file”
Step 5: Compilation
Compile the Kernel using the following commands
Compile to create a compressed kernel image
# make
Compile kernel modules:
#
Install kernel modules
Step 6: Install Kernel
If the above steps completed without any errors , now its the time to Install the new Kernel
It will install three files into /boot directory as well as modification to your kernel grub configuration file:
System.map-x.y.z
config-x.y.z
vmlinuz-x.y.z
Step 7: Create the Initrd image
Type the following command :
#
initrd images contains device driver which needed to load rest of the operating system later on. Not all computer requires it, but it is better to create one
Step 8: Boot Loader Modification
Mofdify the boot loader to boot the new OS as default . Check the documentaions corresponding to your boot loader
Step 9: The last step
execute the following command
#reboot
Wait a few minutes and once it is up , you can see that the new Kernel is loaded
Compiling custom kernel has its own advantages and disadvantages. It helps to optimize the kernel to your environment (hardware and usage patterns). I shall try to guide you through Kernel recompilation process.
Step 1:
Download the kernel source
cd /usr/local/src
wget
http://www.kernel.org/pub/linux/kernel/v2.6/linux-x.y.z.tar.bz2
Note: Replace x.y.z with actual version number.
Step 2:
Extract the source file
tar -xjvf
linux-x.y.z.tar.bz2
Step 3:
Patching the Kernel
If you are requested to apply any patches , follow these steps
a) Move the downloaded kernel patch to the
/usr/local/src
directory.b) Extract the patch file
c) Patch the kernel source using the extracted patch file
cd /usr/local/src/
linux-x.y.z
patch -p1 < patchfile-2.2.x
Now the Kernel Source is patched against known vulnerabilities.
Step 4:
Configuration
If you are trying to upgrade the Kernel of already running server , it is always better use the existing configuration. To do this follow these steps
#uname -a
Linux Server1 2.6.18-164.el5 #1 SMP Thu Sep 3 03:28:30 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux
# cd /boot
There you can see different configuration files as given below
#ls
config-2.6.18-128.el5 initrd-2.6.18-128.el5.img message
config-2.6.18-164.el5 initrd-2.6.18-164.el5.img quota.user*
identify the configuration file corresponding to the version of OS installed , In our case it is config-2.6.18-164.el5 . We are copying this file to the downloaded kernel source to use it during configuration.
#cp -p config-2.6.18-164.el5 /usr/local/src/linux-x.y.z/.config
# make clean
# make mrproper
# make menuconfig
You have to select different options as per your need. If you intended to use the existing configuration ,specify the path to the file ( .config in this case) by selecting the option
“Load an Alternative configuration file”
Step 5: Compilation
Compile the Kernel using the following commands
Compile to create a compressed kernel image
# make
Compile kernel modules:
#
make modules
Install kernel modules
# make modules_install
Step 6: Install Kernel
If the above steps completed without any errors , now its the time to Install the new Kernel
# make install
It will install three files into /boot directory as well as modification to your kernel grub configuration file:
System.map-x.y.z
config-x.y.z
vmlinuz-x.y.z
Step 7: Create the Initrd image
Type the following command :
# cd /boot
#
mkinitrd -o initrd.img-x.y.x x.y.z
initrd images contains device driver which needed to load rest of the operating system later on. Not all computer requires it, but it is better to create one
Step 8: Boot Loader Modification
Mofdify the boot loader to boot the new OS as default . Check the documentaions corresponding to your boot loader
Step 9: The last step
execute the following command
#reboot
Wait a few minutes and once it is up , you can see that the new Kernel is loaded
How to redirect non ssl (http links) traffic to SSL (https links)
Our Level I techs often gets tickets like how to make http:// or http://www. redirect to https:// or https://www. Often the answer is simple, but for the newbies and yours use, I am putting it here.
First requirement is to have an SSL certificate installed. Add the following lines in a .htaccess file:
I assume when you directly access https://www.domainname.com , the site loads fine.
First requirement is to have an SSL certificate installed. Add the following lines in a .htaccess file:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
I assume when you directly access https://www.domainname.com , the site loads fine.
OpenVPN issues on a OpenVZ / Virtuozzo enabled VPS
Error Note: Cannot open TUN/TAP dev /dev/net/tun: Permission denied (errno=13)
Just follow the KB at http://wiki.openvz.org/VPN_via_the_TUN/TAP_device
Error Note: Cannot set tx queue length on tun0: Operation not permitted (errno=1)
As mentioned in the same KB URL, just do the steps below and things should be alright again
Basically the errors are caused by the non-execution of the two commands mentioned above.
Just follow the KB at http://wiki.openvz.org/VPN_via_the_TUN/TAP_device
Error Note: Cannot set tx queue length on tun0: Operation not permitted (errno=1)
As mentioned in the same KB URL, just do the steps below and things should be alright again
vzctl set 101 --devices c:10:200:rw --save
vzctl set 101 --capability net_admin:on --save
Basically the errors are caused by the non-execution of the two commands mentioned above.
Not being able to create postgresql database even after the postgresql package is installed
Recently with a cPanel server, we had this issue of not being able to create postgresql database even after the postgresql package is installed and database server is running. Fixing of one issue lead to another there by needing to fix all the errors.
This was fixed by doing these,
Login to WHM => SQL Services => Postgres Config => Click on “Install Config”.
Login to WHM => SQL Services => Postgres Config => “Set a Postgresql password also”
No error in cPanel after doing above. However that followed by an issue of created DBs not being appeared in the List DB page of Postgresql databases. Went to shell. Logged in as root . Switched to postgres. “su – postgres” . Ran the command “psql” and then
No DB was created. Checked the logs /usr/local/cpanel/logs/error_log and it had entries likeERROR: role “username” does not exist which meant, no roles to create the database.
Cpanel::AdminBin::adminrun(postgres) set error in context postgres
[2010-01-16 12:24:18 -0500] warn [postgres::listdbs] Encountered error in postgres::listdbs: Error from postgres wrapper: PostgreSQL has not been configured by the administrator. Unable to locate pgpass file.
This was fixed by doing these,
Login to WHM => SQL Services => Postgres Config => Click on “Install Config”.
Login to WHM => SQL Services => Postgres Config => “Set a Postgresql password also”
No error in cPanel after doing above. However that followed by an issue of created DBs not being appeared in the List DB page of Postgresql databases. Went to shell. Logged in as root . Switched to postgres. “su – postgres” . Ran the command “psql” and then
-bash-3.2$ psql
Welcome to psql 8.1.18, the PostgreSQL interactive terminal.
Type: copyright for distribution terms
h for help with SQL commands
? for help with psql commands
g or terminate with semicolon to execute query
q to quit
postgres=# l
List of databases
Name | Owner | Encoding
-----------+----------+----------
postgres | postgres | UTF8
template0 | postgres | UTF8
template1 | postgres | UTF8
(3 rows)
postgres=# q
No DB was created. Checked the logs /usr/local/cpanel/logs/error_log and it had entries likeERROR: role “username” does not exist which meant, no roles to create the database.
cd /var/cpanel/users && for x in *; do su -c "createuser -S -D -R $x" postgres; done
Thursday, 14 January 2010
Disable squirrel or horde from webmail.
If a client only wants to use either Horde or SquirrelMail, then follow these steps:
1)
The the client wants to disable Horde:
root@server1[/]# vi /var/cpanel/users/username
Add the following lines:
skiphorde=1
skipsqmail=0
save the file.
root@server1[/]# Service cpanel restart
If a client wants to disable Horde and disable SquirrelMail then add these lines:
skiphorde=0
skipsqmail=1
1)
The the client wants to disable Horde:
root@server1[/]# vi /var/cpanel/users/username
Add the following lines:
skiphorde=1
skipsqmail=0
save the file.
root@server1[/]# Service cpanel restart
If a client wants to disable Horde and disable SquirrelMail then add these lines:
skiphorde=0
skipsqmail=1
Tuesday, 12 January 2010
How To Display Just The HTTP Response Code In Command Line Curl
Today, I was looking for a quick way to see HTTP response codes of a bunch of urls. Naturally, I turned to the curl command, which I would usually use like this:
This command would send a HEAD request (-I), follow through all redirects (-L), and display some useful information in the end. Most of the time it's ideal:
However, the server I was curling didn't support HEAD requests explicitly. Additionally, I was really only interested in HTTP status codes and not in the rest of the output. This means I would have to change my strategy and issue GET requests, ignoring HTML output completely.
Curl manual to the rescue. A few minutes later, I came up with the following, which served my needs perfectly:
Here is a sample of what comes out:
Here, -s silences curl's progress output, -L follows all redirects as before, -w prints the report using a custom format, and -o redirects curl's HTML output to /dev/null.
Here are the other special variables available in case you want to customize the output some more:
Is there a better way to do this with curl? Perhaps, but this way offers the most flexibility, as I am in control of all the formatting. Artem Russakovskii
curl -IL "URL"
This command would send a HEAD request (-I), follow through all redirects (-L), and display some useful information in the end. Most of the time it's ideal:
curl -IL "http://www.google.com"
HTTP/1.1 200 OK
Date: Fri, 11 Jun 2010 03:58:55 GMT
Expires: -1
Cache-Control: private, max-age=0
Content-Type: text/html; charset=ISO-8859-1
Server: gws
X-XSS-Protection: 1; mode=block
Transfer-Encoding: chunked
However, the server I was curling didn't support HEAD requests explicitly. Additionally, I was really only interested in HTTP status codes and not in the rest of the output. This means I would have to change my strategy and issue GET requests, ignoring HTML output completely.
Curl manual to the rescue. A few minutes later, I came up with the following, which served my needs perfectly:
curl -sL -w "%{http_code} %{url_effective}\n" "URL" -o /dev/null
Here is a sample of what comes out:
curl -sL -w "%{http_code} %{url_effective}\n" "http://www.amazon.com/Kindle-Wireless-Reading-Display-Generation/dp/B0015T963C?tag=androidpolice-20" -o /dev/null
200 http://www.amazon.com/Kindle-Wireless-Reading-Display-Generation/dp/B0015T963C
Here, -s silences curl's progress output, -L follows all redirects as before, -w prints the report using a custom format, and -o redirects curl's HTML output to /dev/null.
Here are the other special variables available in case you want to customize the output some more:
- url_effective
- http_code
- http_connect
- time_total
- time_namelookup
- time_connect
- time_pretransfer
- time_redirect
- time_starttransfer
- size_download
- size_upload
- size_header
- size_request
- speed_download
- speed_upload
- content_type
- num_connects
- num_redirects
- ftp_entry_path
Is there a better way to do this with curl? Perhaps, but this way offers the most flexibility, as I am in control of all the formatting. Artem Russakovskii
Changing Exim’s Sending IP
Anyone running a shared hosting server is probably now accustomed to dealing with constant complaints about blacklisting. It’s exim’s default setup on a cPanel server to use the shared IP of the server to send email, which means that all your clients on one server are sending out email on the same IP. All it takes is for one spammer to send out a mailing list or one customer to get hacked and run a Darkmailer script, and suddenly everyone on your server seems to be complaining about getting their mail bounced.
You can change the server’s IP address for sending email. Assuming you already have an IP set up on your server with a valid PTR, you probably already saw on the cPanel forums or some other location that you can simply change the interface lines in your /etc/exim.conf file and restart exim:
remote_smtp:
driver = smtp
interface = ${if exists {/etc/mailips}{${lookup{$sender_address_domain}lsearch*{/etc/mailips}{$value}{}}}{}}
helo_data = ${if exists {/etc/mailhelo}{${lookup{$sender_address_domain}lsearch*{/etc/mailhelo}{$value}{$primary_hostname}}}{$primary_hostname}}
dk_remote_smtp:
driver = smtp
interface = ${if exists {/etc/mailips}{${lookup{$sender_address_domain}lsearch*{/etc/mailips}{$value}{}}}{}}
helo_data = ${if exists {/etc/mailhelo}{${lookup{$sender_address_domain}lsearch*{/etc/mailhelo}{$value}{$primary_hostname}}}{$primary_hostname}}
dk_private_key = "/var/cpanel/domain_keys/private/${dk_domain}"
dk_canon = nofws
dk_selector = default
In the above example, all you’d do is comment out the interface lines and replace them with:
interface = xx.xx.xx.xx
However, this tends to be a band-aid fix, as a cPanel update or any change made in WHM’s Exim Configuration Editor will regenerate the Exim config and overwrite your change. To make this more permanent, you’ll want to use the /etc/mailips file.
To set this up initially, go into WHM > Exim Configuration and enable this option:
** Send outgoing mail from the ip that matches the domain name in /etc/mailips (*: IP can be added to the file to change the main outgoing interface) [?]
Or, in /etc/exim.conf.localopts, add/change this line:
per_domain_mailips=1
Then run
/scripts/buildeximconf
service exim restart
*The /etc/mailips file should be root:exim, chmod 440 if it doesn’t already exist.
chattr +i /etc/mailips
Now for actually changing the IP:
Changing the IP Globally
If you want everyone on the server to send out on the same IP, just add the following to /etc/mailips:
*: xxx.xxx.xxx.xxx
Then add the IP and it’s matching PTR to /etc/mail_reverse_dns:
xxx.xxx.xxx.xxx hostname.tld
This will tell Exim to use that IP for any sender on the server.
Changing the IP Per Domain
If you want your users with dedicated IP addresses to be able to use those IPs to send email as well, you can add them to /etc/mailips. cPanel actually now has documentation on how to do this properly:
If you have multiple dedicated IP domains already, I’ve devised a simple loop you can use to populate /etc/mailips automatically:
while read line ; do DOMAIN=`echo -e $line |awk '{print $2}'` && IP=`echo -e $line |awk '{print $1}' |cut -d: -f1` && echo "$DOMAIN: $IP" >> /etc/mailips ;done < /etc/domainips
You’ll always want the wildcard line to be in there to account for any domain not listed in the file, whether it is the main server’s IP or another that you have assigned for email:
*: xxx.xxx.xxx.xxx
Then:
cp /etc/domainips /etc/mail_reverse_dns
This will set all the existing sites on dedicated IPs to send out mail on those IPs.
Monday, 11 January 2010
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!
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!
How to change the ownership of multiple accounts under /home via SSH?
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
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
E-mail Alert on Root SSH Login
WARNING: According to eApps policy if you edit any system files manually, they might not support the changes you have made. Use at your own risk.
1. Login to your server and su to root, I know the irony!
2. cd /root
3. nano .bashrc
4. Scroll to the end of the file then add the following:
echo 'ALERT - Root Shell Access (YourserverName) on:' `date` `who` | mail -s "Alert: Root Access from `who | cut -d"(" -f2 | cut -d")" -f1`"you@yourdomain.com
Replace YourServerName with the handle for your actual server
Replace you@yourdomain.com with your actual email address
5. Crtl + X then Y
Now logout of SSH, close the connection and log back in! You should receive an email address of the root login alert a few minutes afterwards.
Cheers!!!!
1. Login to your server and su to root, I know the irony!
2. cd /root
3. nano .bashrc
4. Scroll to the end of the file then add the following:
echo 'ALERT - Root Shell Access (YourserverName) on:' `date` `who` | mail -s "Alert: Root Access from `who | cut -d"(" -f2 | cut -d")" -f1`"you@yourdomain.com
Replace YourServerName with the handle for your actual server
Replace you@yourdomain.com with your actual email address
5. Crtl + X then Y
Now logout of SSH, close the connection and log back in! You should receive an email address of the root login alert a few minutes afterwards.
Cheers!!!!
Monday, 4 January 2010
Plesk : Configure qmail to use alternate SMTP port 26
You have a plesk dedicated server and having issues related to SMTP port 25. There are issues where ISP blocks SMTP port 25, in this case we can use alternate port (I will use port 26).
Kindly follow the below steps to change SMTP port on your plesk dedicated (linux) server to 26.
Login to your server as root
root# cd /etc/xinetd.d
root# ls -l | grep smtp*
root# cat smtp_psa
service smtp
{
socket_type = stream
protocol = tcp
wait = no
disable = no
user = root
instances = UNLIMITED
server = /var/qmail/bin/tcp-env
server_args = /usr/sbin/rblsmtpd -r bl.spamcop.net /var/qmail/bin/relaylock /var/qmail/bin/qmail-smtpd /var/qmail/bin/smtp_auth /var/qmail/bin/true /var/qmail/bin/cmd5checkpw /var/qmail/bin/true
}
root# nano /etc/services
Add the below lines
smtp_psa_new 26/tcp mail
smtp_psa_new 26/udp mail
root# cp smtp_psa smtp_psa_new
Change the service line in the new file “smtp_psa_new” to be this:
service smtp_psa_new
{
socket_type = stream
protocol = tcp
wait = no
disable = no
user = root
instances = UNLIMITED
server = /var/qmail/bin/tcp-env
server_args = /usr/sbin/rblsmtpd -r bl.spamcop.net /var/qmail/bin/relaylock /var/qmail/bin/qmail-smtpd /var/qmail/bin/smtp_auth /var/qmail/bin/true /var/qmail/bin/cmd5checkpw /var/qmail/bin/true
}
root# /etc/init.d/xinetd restart
And you should see smtp listening on ports 25, and 26:
root# netstat -anp | grep xinetd
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 6989/xinetd
tcp 0 0 0.0.0.0:26 0.0.0.0:* LISTEN 6989/xinetd
Kindly follow the below steps to change SMTP port on your plesk dedicated (linux) server to 26.
Login to your server as root
root# cd /etc/xinetd.d
root# ls -l | grep smtp*
root# cat smtp_psa
service smtp
{
socket_type = stream
protocol = tcp
wait = no
disable = no
user = root
instances = UNLIMITED
server = /var/qmail/bin/tcp-env
server_args = /usr/sbin/rblsmtpd -r bl.spamcop.net /var/qmail/bin/relaylock /var/qmail/bin/qmail-smtpd /var/qmail/bin/smtp_auth /var/qmail/bin/true /var/qmail/bin/cmd5checkpw /var/qmail/bin/true
}
root# nano /etc/services
Add the below lines
smtp_psa_new 26/tcp mail
smtp_psa_new 26/udp mail
root# cp smtp_psa smtp_psa_new
Change the service line in the new file “smtp_psa_new” to be this:
service smtp_psa_new
{
socket_type = stream
protocol = tcp
wait = no
disable = no
user = root
instances = UNLIMITED
server = /var/qmail/bin/tcp-env
server_args = /usr/sbin/rblsmtpd -r bl.spamcop.net /var/qmail/bin/relaylock /var/qmail/bin/qmail-smtpd /var/qmail/bin/smtp_auth /var/qmail/bin/true /var/qmail/bin/cmd5checkpw /var/qmail/bin/true
}
root# /etc/init.d/xinetd restart
And you should see smtp listening on ports 25, and 26:
root# netstat -anp | grep xinetd
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 6989/xinetd
tcp 0 0 0.0.0.0:26 0.0.0.0:* LISTEN 6989/xinetd
Friday, 1 January 2010
Disable ssl in the database
Using your FTP client, open configuration.php on your Joomla site:
change
to
change
Code:
var $force_ssl = '1';
to
Code:
var $force_ssl = '0';
Subscribe to:
Posts (Atom)