Friday, May 02, 2008

instant Messenger: Openfire, Spark & web chat (Fastpath)

-> Openfire
1 . lynx http://www.igniterealtime.org/downloads/download-landing.jsp?file=openfire/openfire-3.4.5-1.i386.rpm
2 . rpm -ivh openfire-3.4.5-1.i386.rpm
3 . /etc/rc.d/init.d/openfire status
4 . /etc/rc.d/init.d/openfire start
5. Make sure that the firewall is stopped.
6 . http://www.grmtech.com:9090/
7 . From the plugin tab in the web based admin control panel: installed Asterisk-IM Openfire

-> Spark
Download and install on client system.
http://www.igniterealtime.org/downloadServlet?filename=spark/spark_2_5_8.exe

-> web chat
Go to plugin tab in the web based admin control panel:
1.Click on 'Available Plugins'
2. Install the following plugin
a. Spark Fastpath Webchat
b. Fastpath Service
c. Monitoring Service (its is a optional)

How to make a linux server act as a gateway

1. turned on IP forwarding in sysctl.conf by setting the value to 1
2. gave the ip tables command for nat masquerade.
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE
Checked that the commands took effect by:
iptables-save
and then made the entries from iptables-save inside the file /etc/sysconfig/iptables

Check and Rebuilding failed Linux software RAID

# cat /proc/mdstat
# mdadm -D /dev/md0
Detail : http://sitearticles.com/cms/show/43.html

ssh commands to log in without the password

ssh commands to log in without the password
# ssh-keygen -t rsa
* This will generate your id_rsa and id_rsa.pub in the .ssh directory in your home directory
* copy the id_rsa.pub to the .ssh directory of the remote host you want to logon to as authorized_keys2
* If you have more than one host from which you want to connect to the remote host, you need to add the local host's id_rsa.pub as one line in the authorized_keys2 file of the remote host command for the 1and1 servers is:
# scp .ssh/id_rsa.pub u35894953@217.160.226.69:./.ssh/authorized_keys2

:)

Sunday, April 13, 2008

Apache: Proxy and ReverseProxy Server

Redirect your all traffic:
Case:
example.com A record is point to server with IP10.1.31.7 (mean its resolves to IP 10.1.31.7 ), but you are running your web server from example.com on server with IP 10.1.31.8.
So, you want all traffic coming to 10.1.31.7 will redirect to 10.1.31.8.

Do the following changes on server have IP 10.1.31.7 :
1. Run apache.
2. Do the following entry in apache.
a. NameVirtualHost 10.1.31.7
b <VirtualHost 10.1.31.7:80 >
ServerName example.com
ServerAlias www.example.com
DocumentRoot /home/test
ProxyRequests off
ProxyPass / http://www.example.com/
ProxyPassReverse / http://www.example.com/
<Location />
ProxyPassReverse /
</Location>
</VirtualHost>
3. Do the following entry in /etc/hosts.
10.1.31.8 example.com
10.1.31.8 www.example.com
(make sure once you #ping example.com from 10.1.31.7 it resolver's to 10.1.31.8).

Note: its redirect only http request not https.

more you can see on this link

Saturday, April 12, 2008

Removing all blank lines, leading and trailing blank spaces

Removing all blank lines, leading and trailing blank spaces :
#sed '/^$/d; s/^[ ]*//g; s/[ ]*$//g' prabhat.txt > kumar.txt

This command will create new file (kumar.txt) on which it removes blank lines, leading and trailing blank spaces.

Friday, April 11, 2008

Changing Run Levels

On production environment normal run level 3 is used and it get rarely changed.
Runlevel and usage:

  • 0 — Halt
  • 1 — Single-user mode
  • 2 — Not used (user-definable)
  • 3 — Full multi-user mode
  • 4 — Not used (user-definable)
  • 5 — Full multi-user mode (with an X-based login screen)
  • 6 — Reboot
Check run level using :-
#who -r or #runlevel

Change run level using:-
#telinit 5 or
open file
#emacs /etc/inittab
Look for the default runlevel called initdefault which look like as follows:
id:3:initdefault:
Replace run level x with y (where x is current run level and y you want to set).

Set services in run level using :
#ntsysv or
#
chkconfig or
#serviceconf

Tuesday, April 01, 2008

How To: Transfer your PuTTY settings between computers

Putty stores its settings in the Windows registry. To save a backup of your Putty settings, you'll need to export this registry key to a file.

HKEY_CURRENT_USER\Software\SimonTatham

Steps :
1. Click Start->Run and type "RegEdt32" in the "Open" dialog. Click "Ok"
2. One RegEdt32 starts, you'll be presented with an application.
3. Press "Ctrl+F" to bring up the Find dialog. Enter the name of the key, "SimonTratham" in the "Find What" field, and make sure only "Keys" is checked in the "Look At" section of the dialog. Finally, click "Find Next"
4. The search may take a while, reminding us that the Windows Registry is a large and mysterious place where dragons be. Let's use these few seconds to reflect on the fact that you should never, ever, never change things in the registry unless you are absolutely, positively, totally, completely, 100% dead sure that you know exactly what you're doing. When the search completes we'll see the key name for which we're looking.
5. Click File->Export. Give your file an appropriate name like, "putty.reg" and click "Save"
6. We're done! Save the putty.reg file somewhere safe. The file doesn't contain any passwords or actual SSH key values so, it's relatively safe from prying eyes. Still, it does contain your configuration and that kind of data is a private matter.


Importing Your PuTTy Configuration:
Windows will ask you for confirmation that you want to import this set of registry values. We know this file is safe, because we created it but, you should never import registry information from an unknown source

Wednesday, March 19, 2008

Remove all empty directories

$ cleanlinks

this is supported on few flavor of Linux (XFree86), you can use this script.

#/bin/bash
DIR="$1"
[ -d $DIR ] && [ $(ls -l $DIR | wc -l) -eq 1 ] && rmdir $DIR || :


$ script.sh dir1

Removing blank line from file

Using sed.
$ sed '/^$/d' withblankline.txt > withoutblankline.txt
Using grep.
$ grep -v '^$' withblankline.txt > withoutblankline.txt

Use following for loop (shell script) to remove all blank lines from all files stored in /home/prabhat/data directory:


#!/bin/sh
files="/home/prabhat/data/*.txt"
for f in $files
do
sed '/^$/d' $i > $i.out
mv $i.out $i
done

How to check reverse DNS

The DNS is used to determine what IP address is associated with a given host name, so to reverse resolve a known IP address is to lookup what the associated host name for it. A reverse lookup is often referred to simply as reverse resolving, or more specifically reverse DNS lookups.

Use of reverse DNS.

Anti-spam
Network troubleshooting
Avoid spammers and phishers using a forward confirmed reverse DNS etc

Check reverse DNS for given IP address under Linux or Windows XP/Server 2003.
You can use standard UNIX / Linux utilities such as nslookup, dig or hosts to find out reverse DNS of a given IP address.

eg; under Linux/UNIX/
$ host 66.65.123.34
or
dig -x IP (66.65.123.34)
and under Linux/UNIX/Windows
nslookup 66.65.123.34

Monday, January 07, 2008

ssh warning

This is not a big thing, but sometime this small things matter a lot.

You can put a message on remote ssh login for user or it will just act as a warning for a defaulters.

Steps:
1. Open a file using : emacs /etc/motd and write a messge you want
e.g.
********************************************************************
* *
* This system is for the use of authorized users only. Usage of *
* this system may be monitored and recorded by system personnel. *
* *
* Anyone using this system expressly consents to such monitoring *
* and is advised that if such monitoring reveals possible *
* evidence of criminal activity, system personnel may provide the *
* evidence from such monitoring to law enforcement officials. *
* *
********************************************************************
==========================================================
Unauthorized access to this machine is prohibited
Press if you are not an authorized user

2. Save the file and exist.
3. Restart the ssh service using. #service sshd restart