Monday, February 21, 2011

Disable ssh root direct login

For security reasons it is not a good idea to allow ssh root direct login, it is better to login as another usre and then switch to root using "su" command.

To do this you need to disable root from login directly using ssh protocol, this will decrease the possibility of a hacker breaking your system, as now he will have to guess your user name and password.

1. Edit the file /etc/ssh/sshd_config

vi /etc/ssh/sshd_config

2. Locate this line with, writing this onces editing with vi or vim


3. If it says

Protocol 2, 1 change it to Protocol 2

*This will enable only ssh2 which is more secure that ssh, do not do this if you need to log with a client that only support ssh, and not ssh2 protocol.

4.Next locate this line "PermitRootLogin yes" by entering this on your vi or vim editor

:/PermitRootLogin yes

and change it to no

PermitRootLogin no
4. Then save the file using shift+zz

5. Now restart the ssh service.

/etc/init.d/sshd restart

Monday, February 14, 2011

Sending emails from the localhost in php

Following article describes how to send an email from local host using XAMPP , WAMP or any other PHP servers. You have to do the following configurations in php.ini file in your local server.

1.Search for the attribute called "SMTP" in the php.ini file. Generally you can find the line "SMTP="localhost"". Change the localhost to smtp server name of your ISP and there is another attribute called "smtp_port" which should be set to 25.

2.) Specify the following headers and try to send the mail.

$headers = ‘MIME-Version: 1.0′ . “\r\n”;
$headers .= ‘Content-type: text/html; charset=iso-8859-1′ . “\r\n”;
$headers .= ‘From:’ . “\r\n”;
mail(“”,”test subject”,”test body”,$headers);

Well that’s all, the mail is sent to “” from the localhost.