Archive for the ‘Linux’ Category

Cpanel: SMTP: Failed to write to socket: not connected (code: -1, response: )

Monday, February 20th, 2012

Error:

I am getting below error message when i try to send email via horde (or) roundcube (or) squirrelMail

Failed to set sender: info@emailaddress.com [SMTP: Failed to write to socket: not connected (code: -1, response: )]

Solution:1
Try to find csf firewall is installed on whm. If yes follow the below steps if not skip to Solution:2

1. Login to WHM
2.WHM > Plugins > ConfigServer Security&Firewall > Firewall Configuration
3.In that file, ensure that “SMTP_ALLOWLOCAL” has a 1 next to it. If it does not, change to 1 and click the “Change” button
4. Restart CSF

Solution:2
Try to find mail service is running
1. Login to server via ssh
2. Service exim status. If stopped execute the below command
3. Service exim restart.

Hope the above solutions might fix the issue.

List of free OpenVZ template

Monday, February 20th, 2012

Hi All,

I am here to share you few free openvz  template.

Centos:
centos-4-x86.tar.gz - 151 MB
centos-4-x86_64.tar.gz - 164 MB
centos-5-x86.tar.gz - 173 MB
centos-5-x86_64.tar.gz - 183MB
centos-6-x86.tar.gz - 192MB
centos-6-x86_64.tar.gz - 205MB

Debian:
debian-5.0-x86.tar.gz - 132MB
debian-5.0-x86_64.tar.gz - 134MB
debian-6.0-x86.tar.gz - 149MB
debian-6.0-x86_64.tar.gz - 151MB

Fedora:
Fedora 13 i386 - 154MB
Fedora 13 x86_64 - 163MB
fedora-15-x86.tar.gz - 204MB
fedora-15-x86_64.tar.gz - 204MB

Suse:
suse-11.3-x86.tar.gz - 187MB
suse-11.3-x86_64.tar.gz - 191MB
suse-11.4-x86.tar.gz - 186MB
suse-11.4-x86_64.tar.gz - 190MB

Ubuntu:
ubuntu-8.04-x86.tar.gz - 108MB
ubuntu-8.04-x86_64.tar.gz - 110MB
ubuntu-10.04-x86.tar.gz - 135MB
ubuntu-10.04-x86_64.tar.gz -138MB
ubuntu-10.10-x86.tar.gz - 129MB
ubuntu-10.10-x86_64.tar.gz - 135MB
ubuntu-11.04-x86.tar.gz - 121MB
ubuntu-11.04-x86_64.tar.gz - 127MB
ubuntu-11.10-x86.tar.gz - 123MB
ubuntu-11.10-x86_64.tar.gz - 125MB

Openvz template – Centos + Cpanel
CentOS 5 i386 w/cPanel  (32bit)
CentOS 5 x86_64 w/cPanel (64bit)

Openvz template – Centos + Webmin
CentOS 5 i386 w/Webmin (32bit)
CentOS 5 x86_64 w/Webmin (64bit)

 

domainname.com/cpanel is not working

Friday, January 20th, 2012

Hi,

I am here to provide you the solution which i have found from cpanel forum for domainname.com/cpanel is not working.

One of my client can able to access the domain name via cpanel port but unable to access it via /cpanel.

http://domainame.com:2082 — > works

http://domainname.com/cpanel  —- > Not working

Solution:

1. Need to check the httpd.conf file on server whether it have the below lines.If not we need to add it.

ScriptAlias /cpanel /usr/local/cpanel/cgi-sys/redirect.cgi

2.Open /var/cpanel/cpanel.config and search for alwaysredirecttossl word and change it to Zero.

3.Restart Cpanel.

That’s it. It will start to work

Simple Linux Server Security Tips

Thursday, August 18th, 2011

Linux is one of the secured operating system. However, With the world of crackers (Evil minded Geeks & Hackers) Linux is also not so secure as we think.

Step 1: How to secure SSH port in Linux server?

Gaining SSH root access is the primary goal of every crackers around. Once they could get root access., They will install rookkits, keyloggers, mail bombs and etc. So, They usually try to gain access to your server using some formal password combinations.  They attempt to login to your server using bruteforce method.

SSH always runs on port number 22

You have to change it to some non-default number like., 2323 or 3009  some number that is hard to guess.

/etc/ssh/sshd_config

above file is the default ssh configuration file. You can change its “Port” value by opening it using Vi or Nano.  CentOS Documentation has clear information about how to change linux server ssh port to a non-standard number. This instructions applies for any redhat kernel based distro.

Step 2: Always check your /tmp folder

It is like., Checking your trash can of your bedroom for any hidden cams. Yes., Some crackers upload a *.php  *.py *.sh files to your server’s /tmp file and let them to become a primary spamming bot in your server.  You have to always try to find if there are any suspicious file around there in /tmp and delete them.  Usually deleting the file wont pay off. You have to find the source loop hole that allows such file in /tmp . You have to audit your web applications that allows file-uploads and anonymous FTP uploads to your server.

Step 3: Disable Anonymous FTP Service

Enabling anonymous FTP service is most like., Inviting robbers by opening your house window.

 

/etc/proftpd.conf

/etc/vsftpdvsftpd.conf

Simply disable anonymous FTP.

Step 3:  Always use SFTP and completely stop using FTP

SFTP is more secure than you think. Most windows based ftp clients such as filezilla, smartftp & coreftp could be affected by many malwares and it will upload “Trojan Horse JavaScript” code to your website files. I personally got affected my many javascript trojans because of virus infected ftp client transfers.  This wiki page has clear & simple information about how to install SFTP

Step 4:  How to disable direct file or image hotlinking?

Lets say you have a cool picture file in your website. http://mywebsite.com/images/picture.jpg  . If  a guy puts your file in his website and lets say his website has thousands of visitors per day., Then, You will be endup paying money for your excessive bandwidth. Disabling hotlink is like., Saving money in your server bandwidth. This is one of the best tool that lets your to generate .htaccess code for hotlink protection.

 

 

Rpm for Perl-GD

Monday, August 8th, 2011

Hi,

Below is the rpm required for Perl-GD

Perl-GD

rrdtool installation in centos

Monday, August 8th, 2011

Hi,

Easy way to install rrdtool in centos via yum

Add the below repo to your yum repo

#vim yum.repos.d

[rrdtool]
name=rrdtoll RPM Repository for Red Hat Enterprise Linux
baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
gpgcheck=1
gpgkey=http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
enabled=1

# yum install rrdtool

That’s it . You are done. !!!!!

Steps to install GD Library in Centos

Monday, August 8th, 2011

Hi,

You can download the GD library from the following url : Download

# tar -zxf gd-2.0.35.tar.gz
# cd 2.0.35
# ./configure
# make
# make install

# /usr/local/lib (default library location)
# /usr/local/include (library included files location)

# ./configure –prefix=/usr ( optional to upgrade) and do # make && make install

How to assign multiple IP’s in Debian Linux

Friday, May 14th, 2010

Debian Linux command to get into network interface card

#vi /etc/network/interfaces

How to assign multiple IP addresses in debian linux:

You can assign multiple IP addresses to the same network interface by using interface alias. This is useful if you need to have more than one server visible on the internet. Note that for multiple Apache servers you can use virtual hosts to add as many servers as you like with one single IP address.Apache simply utilises the domain name supplied by the client in the http host header.

You must turn off dhcp because you must use static assignment if you are configuring multiple IPs, so basically this file is:

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.1.90
gateway 192.168.1.1
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255

Assuming that you interface is eth0, you can assign three IP addresses editing /etc/network/interfaces similar to this:

# the loopback interface
auto lo
iface lo inet loopback

#
auto eth0
iface eth0 inet static
address 192.168.1.42
netmask 255.255.255.0
broadcast 192.168.1.255
gateway 192.168.1.1

auto eth0:0
iface eth0:0 inet static
address 192.168.1.41
netmask 255.255.255.0
broadcast 192.168.1.255

auto eth0:1
iface eth0:1 inet static
address 192.168.1.43
netmask 255.255.255.0
broadcast 192.168.1.255

auto eth0:2
iface eth0:2 inet static
address 192.168.1.44
netmask 255.255.255.0
broadcast 192.168.1.255

Note that gateway is only assigned to eth0. If you include dns-nameservers, it should also only be specified for eth0.

If you make changes to this file you can cause them to take effect by running:
/etc/init.d/networking restart

# /etc/init.d/networking restart
Reconfiguring network interfaces…if-up.d/mountnfs[eth0]: waiting for interface eth0:0 before doing NFS mounts (warning).
if-up.d/mountnfs[eth0]: waiting for interface eth0:1 before doing NFS mounts (warning).
if-up.d/mountnfs[eth0]: waiting for interface eth0:2 before doing NFS mounts (warning).
if-up.d/mountnfs[eth0:0]: waiting for interface eth0:1 before doing NFS mounts (warning).
if-up.d/mountnfs[eth0:0]: waiting for interface eth0:2 before doing NFS mounts (warning).
if-up.d/mountnfs[eth0:1]: waiting for interface eth0:2 before doing NFS mounts (warning).
done.

How to fix  if-up.d/mountnfs[eth0:1]: waiting for interface eth0:2 before doing NFS mounts (warning). ?

Reconfiguring network interfaces…if-up.d/mountnfs[eth0]: waiting for interface eth0:0 before doing NFS mounts (warning).
if-up.d/mountnfs[eth0]: waiting for interface eth0:1 before doing NFS mounts (warning).
if-up.d/mountnfs[eth0]: waiting for interface eth0:2 before doing NFS mounts (warning).
if-up.d/mountnfs[eth0:0]: waiting for interface eth0:1 before doing NFS mounts (warning).
if-up.d/mountnfs[eth0:0]: waiting for interface eth0:2 before doing NFS mounts (warning).
if-up.d/mountnfs[eth0:1]: waiting for interface eth0:2 before doing NFS mounts (warning).
done.

Solution:

It means that it is making sure that all ‘net interfaces are up before trying to mount a network based filesystem.

Ubuntu Linux Toolbox

Saturday, July 19th, 2008

Ubuntu Linux Toolbox:
ubuntu,linux commands
1000+ Commands for Ubuntu and Debian Power Users

Download From Here:
http://rapidshare.com/files/128055296/Wiley.Ubuntu.rar

Javascript Trojan Virus Everywhere and How to fix it

Saturday, March 1st, 2008

Its getting hit by Trojan virus:

Read the News about Thousands of infected websites.

A lot of sites are now being attacked with JavaScript Trojans

the server is not attacked by virus , this happens to both Linux and windows server sites.

so it is doesnt look like a server based attack

How this happens?

when the computer from where you upload data thru FTP/fp is infected , it injects some JavaScript to all html files.

so how you can prevent this happening is keep your pc up2date by having recent antivirus,antispyware and then change your ftp logins.

If there is a Repeating same pattern of JavaScript on 100s of your files you have a shell script for Linux server users that can remove these injected javascript .

so you can request your host or you yourself can run this on your shell


find ./ -type f -exec sed -i ‘/unescape/d’ {} \;

this command will remove all the lines with pattern ‘unescape’

some virus has lines of function okban, in that case you can try pattern ‘okban’

it depends on your need.

you can do the same with a software called GrepWin for replacing/searching PERL Regular Expression patterns on your files

http://tools.tortoisesvn.net/grepWin

use it to search for patterns and replace with null or use the options to delete those lines

this can be either used on a windows server or client side (but then you have to upload all modified files again )


				

Searching files on linux

Sunday, December 30th, 2007

To find files quickly on the redhat based distributions (fedora,centos,rhel,etc)

search files

You need to first index the file names before you can search them quickly for this command is

updatedb &
man updatedb

& (lets you to run the command in background so you can do something now
in shell in mean time)

then after it is done.

you can find files using command locate

locate [filename or part of filename]

Example

[xxx@server1 plugins]$ locate wysiwyg
/scripts/wysiwygpro_cleanup
[xxx@server1 plugins]$
man locate
You have to update the index periodically else it will be outdated and not pretty useful as it should be

so add this to your cron job to make it run once daily
$crontab -e
1 1 * * * /usr/bin/updatedb

This will update it daily to the db

If you dont want to index it daily & If your files rarely change you
can change it weekly or monthly by just changing it accordingly on crontab

making , editing crontab is out of subject of this article but the
simple way is

crontab -e & paste that cron command and then save it.

Online Cron command generator

Finding binary/executabe paths on linux/unix

Sunday, December 30th, 2007

Many scripts and softwares may ask you a path for another tool, For its main or additional functionality

For example: many php scripts will ask you path to imagemagic, GD Library like path to convert utility.

You can use tool like which , whereis

which [command or binary name]
man which

whereis [command or binary name]
man whereis
Example

which php
whereis php
which convert
whereis convert

and whereis will show more information than which command