If we get following error of while try to restart httpd:httpd not running, trying to start
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:443
no listening sockets available, shutting down
Unable to open logs
Simply log in as root and fire the command which is given below:
netstat -lpn | grep '0.0.0.0:80'
It will show the result something like:
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 14829/httpd
Then kill the PID and kill all the processes of the service and try to restart it.
root@server [~]# kill -9 14829
root@server [~]# killall -9 httpd
root@server [~]# /etc/init.d/httpd restart
Enjoy:)
make_sock: httpd error
Posted by Mayur's BLOG 0 comments
Outlook Express
Posted by Mayur's BLOG 0 comments
Outlook Setting:
1. Open Out Look Express [if you don’t have outlook express software in your PC, consult
with your Hardware Engineer for support]
2. Click On ‘Tools’ [on top header]
3. Select ‘Accounts’
4. Click on ADD>>
5. Select Mail
6. Give - Display Name: Your Company Name’ [>next>]
7. Email Address: Your Mail address (for ex: info@YourDomainName.Com) [>next>]
8. Incoming Mail Server: mail.YourDomainName.Com Or Your doamain name
9. Outgoing Mail Server: mail.YourDomainName.Com [ or your Local ISP Server/IP address]
[>next>]
10. Account Name: Your complete Mail address [info@YourDomainName.Com ]
11. Password: **** your mail password [>next>]
12. and Click Finish
13. Again from main screen >> Tools >> Accounts >> Select your respective email account
>> Click on Properties >> Go to Servers Tab >> Keep a TICK to “My Server Requires
Authentication”. Then Go to Advance tab >> Outgoing Mail [25], Incoming Mail [110]
14. Make sure by this time you would have already connected to Internet.
15. Now check for the new Mails through clicking on Send / Recv button on the home page
of Out Look Express.
Outlook Express not downloading new mails automatically
Once an account is set up in a mail client, the new mails will be automatically downloaded whenever we open the email client program. If the mail client does not download the new mails then do the following :
1. In Outlook Express, click on Tools --> Options
2. Select "General" tab.
3. Make sure the option "Send and receive messages at startup" is set in "Send / Receive Messages".
4. If not select that option and save the settings.
Outlook Express not showing sent mails in sent items folder
By default, the mails sent will be stored in Sent Items in outlook express. If the mail client is not at all showing those mails in that folder, please do the following.
1. In outlook express, click on Tools -> Options
2. Select Send tab
3. Make sure the option "Save a copy of sent messages in the Sent Items folder" is selected.
4. If it was not selected, select that option and save the settings.
Enjoy:)
5. Also, make sure the option "Send messages immediately" is checked.
How to Block Email From a Specific Address by using Exim ?
Posted by Mayur's BLOG 0 comments
While working on a client project that had a mass member email function, I needed a way to test the system exactly as it would run in production. This meant, when it ran, it would send emails to all of the members in the directory instead of a test email address. The only problem was I didn’t want to send test emails out to the thousands of members in the directory.
So I wanted a way have PHP still send the email out as it normally would but have the mail server (EXIM) kill it before it left the server.
Luckily this is very easy to do. With EXIM, you can setup filters that can perform a large number of tasks, like blocking message, or blind copying messages to other email addresses. In this case, I’m going to create a filter to cause an email coming from a specific sender to fail (the email address I use to send the email in PHP).
What you’ll want to do is find your System Filter File for EXIM. In WHM, you can find this file listed in your EXIM Configuration Editor about half way down the page.
Once you’ve located the file, log into SSH and edit the file.
pico /path/to/your/file
Then enter the following filter into the file and save it:
if first_delivery
and ( ("$h_from:" contains "emailtoblock@mydomain.com")
)
then fail
endif
If you’d like a copy of the email sent to you after the message fails
so you can make sure it is correctly formatted, just add one line:
if first_delivery
and ( ("$h_from:" contains "emailtoblock@mydomain.com")
)
then
unseen deliver "youremail@yourdomain.com"
fail
endif
I suggest you read up more about EXIM filtering for more advanced functions.
Where I Learned This: I found the solution the Imthiaz Blog and the Exim Documentation.
Enjoy:)
DOS attack
Posted by Mayur's BLOG 0 comments
This will also help you
netstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n
Above command will show the list of IP addresses with their connections on our server
route add xxx.xx.xx.xxx reject
netstat -n | grep :80 | wc -l;uptime ; netstat -n | wc -l
Above command will show total number of connections
* Also do this to lower down the server load
steps to lower the load. If you want stats to continue to run even with a high load; Edit
/var/cpanel/cpanel.config and change extracpus to a number larger then 0 (run
/usr/local/cpanel/startup afterwards to pickup the changes).
I'll update it if I get more info on it
Enjoy:)
How to clear cpanel logs ?
Posted by Mayur's BLOG 0 comments
echo > /var/log/exim_mainlog
echo > /var/log/exim_rejectlog
echo > /var/log/maillog
echo > /var/log/messages
echo > /var/log/messages.1
echo > /var/log/messages.2
echo > /var/log/messages.3
echo > /var/log/messages.4
echo > /var/log/lastlog
echo > /var/log/maillog
echo > /var/log/maillog.1
echo > /var/log/maillog.2
echo > /var/log/maillog.3
echo > /var/log/secure
echo > /var/log/secure.1
echo > /var/log/secure.2
echo > /var/log/secure.3
echo > /var/log/secure.4
echo > /usr/local/apache/logs/access_log
echo > /usr/local/apache/logs/suexec_log
echo > /usr/local/apache/logs/error_log
echo > /usr/local/cpanel/logs/access_log
echo > /usr/local/cpanel/logs/error_log
echo > /var/log/exim_mainlog.1
echo > /usr/local/cpanel/3rdparty/mailman/logs/locks
echo > /var/log/cron.2
echo > /var/log/secure.2
echo > /var/log/secure.3
echo > /var/log/secure.4
echo > /usr/local/apache/logs/access_log
echo > /usr/local/apache/logs/suexec_log
echo > /usr/local/apache/logs/error_log
echo > /usr/local/cpanel/logs/access_log
echo > /usr/local/cpanel/logs/error_log
echo > /var/log/exim_mainlog.1
echo > /usr/local/cpanel/3rdparty/mailman/logs/locks
echo > /var/log/cron.2
echo > /var/log
Simply fire above command from shell prompt
Enjoy:)
I can't login to DirectAdmin on port 2222
Posted by Mayur's BLOG 0 comments
If you are unable to access your server via http://1.2.3.4:2222, then 1 of 3 things is likely happening:
1. DirectAdmin might not be running or
2. You have a firewall blocking port 2222.
Number 2. is easy to check by simply running (only on redhat systems):
/sbin/service iptables stop
/sbin/chkconfig iptables off
If that didn't fix it, then you'd need to check your /var/log/directadmin/error.log to check for any errors as to why it isn't starting:
tail /var/log/directadmin/error.log
Common problems are:1. Incorrect ethernet_dev set in the /usr/local/directadmin/conf/directadmin.conf file. guide
2. Invalid license, either due to wrong uid/lid, IP, or date. Try: Updating your DirectAdmin License manually
3. Binaries for a different operating system.
You can always try running DirectAdmin by hand (if it's not already running) to see what the problem is.
cd /usr/local/directadmin
./directadmin b200
If you cannot login because of incorrect password simply login as root and reset it
root@server [~]# passwd admin
new password:
Enjoy:)
find command:
Posted by Mayur's BLOG 0 comments
find - search for files in a directory hierarchy
Some useful syntax for find commands
find -perm 777 - to find files and folders which have 777 permission
find -user nobody - to find files and folders which have nobody ownership
find -name "test" - to find files or folders which have the name "test"
You can use special caracters like *, ?, \ etc with find command as per your requirment.
For exa- How to find all directories and files from /home which have the name contents like "fishingbank" with the nobody ownership ?
root@server [~]# find /home/ -name "*fishingbank*" -user nobody
Please read man page for more info
Enjoy:)