ABHIONLINUX
Site useful for linux administration and web hosting

2009/11/28

CPanel EXIM error – remote_smtp defer (111): Connection refused

On a cPanel dedicated server, exim was unable to deliver emails and all the emails were stuck in mail queue. Here what we found in the exim_mainlog

2009-03-22 03:46:04 H=localhost (Server-IP) [127.0.0.1] Warning:
Sender rate 0.0 / 1h
2009-03-22 03:46:04 1LlJJk-0003cX-HY <= test@somedomain.com H=localhost (Server-IP) [127.0.0.1] P=esmtpa A=fixed_login:test@somedomain.com S=798 id=1853.17.23.12.34.1237711564.squirrel@Server-IP
2009-03-22 03:46:07 1LlJJk-0003cX-HY alt3.gmail-smtp-in.l.google.com [209.85.218.31] Connection refused
2009-03-22 03:46:10 1LlJJk-0003cX-HY alt4.gmail-smtp-in.l.google.com [209.85.221.10] Connection refused
2009-03-22 03:46:10 1LlJJk-0003cX-HY == ourtestmail@gmail.com R=lookuphost T=remote_smtp defer (111): Connection refused

While troubleshooting the issue, we found the following:

root@server [~]# iptables -nL

Chain OUTPUT (policy ACCEPT)
target prot opt source destination
ACCEPT tcp -- 0.0.0.0/0 127.0.0.1 tcp dpt:25
REJECT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:25
reject-with icmp-port-unreachable

You have to remove this two iptables rules.

root@server [~]# iptables -D OUTPUT 2
root@server [~]# iptables -D OUTPUT 1

You then have to save iptables and restart.

root@server [~]# /etc/init.d/iptables save
root@server [~]# /etc/init.d/iptables restart

Now, check your mails and you will see all the mails getting delivered.

MySQL Commands:

1.login mysql from GNU/Linux shell.
$mysql -h hostname -u root -p

2.Creating a database.
mysql> create database [Database_Name];

3.List all databases.
mysql> show databases;

4.List all the tables in a database.
mysql> show tables;

5.For Switching to a particular database.
mysql> use [Database_Name];

6.List database field formats in a table.
mysql> describe [Table_Name];

7.Delete a database.
mysql> drop database [Database_Name];

8.Delete a table.
mysql> drop table [Table_Name];

9.List all data in a table.
mysql> SELECT * FROM [Table_Name];

10. Show unique records.
SELECT DISTINCT [column name] FROM [table name];

11. Change a users password.(from unix shell).
mysqladmin -u root -h hostname.blah.org -p password 'new-password'

12. Change a users password.(from MySQL prompt).
SET PASSWORD FOR 'user'@'hostname' = PASSWORD('passwordhere');

13. Allow the user "sree" to connect to the server from localhost using the password "mypass"
grant usage on *.* to 'sree'@'localhost' identified by 'mypass';

14. Update database permissions/privilages.
FLUSH PRIVILEGES;

15. Dump all databases for backup. Backup file is sql commands to recreate all db's.
mysqldump -u root -p password --opt >/tmp/alldatabases.sql

16. Dump one database for backup.
mysqldump -u username -ppassword --databases databasename >/tmp/databasename.sql

17. Dump a table from a database.
mysqldump -c -u username -ppassword databasename tablename > /tmp/databasename.tablename.sql

18. Restore database (or database table) from backup.
mysql -u username -ppassword databasename < /tmp/databasename.sql

or

# mysql database_name < database.sql