Sunday, July 8, 2007

Quick fixes for issues on Linux and Windows server : part B)

Following are the useful commands and tweaks used on Linux and Windows server :

H) Mails are not delivering from Mail Queue Manger.:

1) Go to shell.

2) service iptables save

3) service iptables stop

4) iptables -A INPUT -p tcp --dport 953 -j ACCEPT
5) iptables -A INPUT -p tcp --dport 53 -j ACCEPT
6) iptables -A INPUT -p udp --dport 53 -j ACCEPT
7) iptables -A INPUT -p udp --dport 953 -j ACCEPT

===================================================

I) Steps to change the Hostname of Linux server:

1) login to your server via ssh

2) su -

3) wget http://ezsm.net/hostname.sh

5) sh hostname.sh

6) answer the questions

7) done.

===================================================

J) How to install ssl from existing or from backup folder :

1) check if the domain has dedicated IP

2) cp /backup/new/cpbackup/weekly/user.tar.gz

3) un-tar the file

4) cd user/sslkeys/

5) copy .key file to /usr/share/ssl/private

6) cd sslcerts/

7) cp .cabundle to /usr/share/ssl/certs

8) cp .crt to /usr/share/ssl/certs

9) in whm Install a SSL Certificate and Setup the Domain

===================================================

K) How to configure php through command line :

./configure --with-apxs=/usr/local/apache/bin/apxs --prefix=/usr/local
--with-xml --enable-bcmath --enable-calendar --with-curl --enable-exif
--enable-ftp --with-gd --with-jpeg-dir=/usr/local --with-png-dir=/usr
--with-xpm-dir=/usr/X11R6 --with-gettext --enable-mbstring
--enable-mbstr-enc-trans --enable-mbregex --with-mcrypt --with-mhash
--with-ming=../ming-0.2a --enable-magic-quotes --with-mysqli
--with-mysql=/usr --with-openssl --enable-discard-path --with-pear
--enable-xslt --with-xslt-sablot --enable-sockets --enable-track-vars
--with-ttf --with-freetype-dir=/usr --enable-gd-native-ttf
--enable-versioning --enable-wddx --with-xmlrpc --with-zip --with-zlib

===================================================

L)How to Reset password for root in Mysql (Linux / Windows)

For Linux

1) mysqld --skip-grant-tables -u mysql &
2) mysql

For Windows

1) Go to mysql directory bin/
2) mysqld-nt --skip-grant-tables
2) Open new command prompt.
3) Go to mysql directory bin/
4) mysql -uroot/admin
Comman commands
5) flush privileges;
6) UPDATE user SET password=password("your root password") WHERE
user="root/admin"; #to reset password
7) GRANT ALL PRIVILEGES ON *.* TO root/admin@localhost IDENTIFIED BY
'password' WITH GRANT OPTION; # grant all privilege
8) flush privileges;
9) \q

==================================================

M) How to delete footer in Horde + plesk

Two options:

Option 1 -
If you want to disable it entirely, edit
/home/httpd/vhosts/webmail/horde/imp/config/config.php and look for this
portion of the configuration:
1) Search for: $conf['msg']['append_trailer'] = true;
2) change from true to false.
Option 2 -
1) edit /home/httpd/vhosts/webmail/horde/imp/config/trailer.txt

===================================================

N) How to create a service in windows plesk ( sw-soft) :

sc create "DrWebCom" binPath= "C:\Program

Files\SWsoft\Plesk\DrWeb\drwebcom.exe" DisplayName= "DrWebCom"

sc create "service name" binPath= "path of service" DisplayName="Displayname"

===================================================

O) How to reset password of mysql in Linux + plesk :

1) Load MySQL with the 'skip-grant-tables' in /etc/my.cnf like below.
[mysqld]
default-character-set=latin1
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
set-variable=max_connections=500
skip-grant-tables

2) Log on the MySQL server and set an empty password for root.

3) Comment out or remove string 'skip-grant-tables' like below.
[mysqld]
default-character-set=latin1
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
set-variable=max_connections=500
#skip-grant-tables

4) Then restart mysqld service with command

/sbin/service mysqld restart

==================================================

P) Adding spf record in dns Zone: ( cPanel)

1) go to the db file of the domain vi /var/named/domainname.com.db
2) add this line <> 14400 IN TXT "v=spf1 a mx ptr ~all"

Thats all

===================================================

Q) How to find out from where the files are uploading in /tmp folder :

1) go to cd /usr/local/apache/domlogs/

2) type cmd grep GET * |grep /tmp *

===================================================

R) How to find DDos attack on a server :

netstat -autpn | grep :80 | wc -l

netstat -tn | grep :80 | grep 65.254.51.82 | cut -c 45-65 | sort -n | less7

route add reject

===================================================

S) How to trace spam on a server :

open exim.conf file by vi /etc/exim.conf and paste following lines in third line of file

log_selector = +address_rewrite +all_parents +arguments +connection_reject
+delay_delivery +delivery_size +dnslist_defer +incoming_interface
+incoming_port +lost_incoming_connection +queue_run +received_sender
+received_recipients +retry_defer +sender_on_delivery +size_reject
+skip_delivery +smtp_confirmation +smtp_connection +smtp_protocol_error
+smtp_syntax_error +subject +tls_cipher +tls_peerdn \

====================================================

T) How to add ports in iptables:

# iptables -A INPUT -p tcp -m tcp --dport -j ACCEPT
# iptables -A INPUT -p tcp -m tcp --dport 2086 -j ACCEPT

====================================================

U) Kill all pocesses running by Nobody :

ipcs -s | grep nobody | perl -e 'while () {@a=split(/\s+/); print

`ipcrm sem $a[1]`}'

====================================================