Tuesday, October 21, 2008

Tips for Linux


Tips for Linux Ubuntu Fedora Centos RHEL Unix etc

Some special Tips for Open source OS
===============================================



How to find a text in a file:


find | xargs grep "aplus.net"



---------------------------------------------



Change XP administrative password:



control userpasswords2





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

.asp=active server pages



PHP=php hypertext Preprocessor


How to count number of file in a folder:


# For file count

ls *.rpm | wc -l





#NTFS

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



How to format a dive in windows XP:


format z: /FS:FAT32




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

Spiderzilla for GNU/Linux (or other *nix systems)



This version is working only when you have xfree and HTTrack packages installed.

Why Xfree? Because Spiderzilla is using xterm.

After that you can install HTTrack from sources from this address httrack-3.33.tar.gz.



To install HTTrack here are the command lines:

$ tar xvfz httrack-*.tar.gz

$ cd httrack-*

$ ./configure --prefix=/usr/local && make

# make install (root permissions required to install HTTrack)

$ /usr/local/bin/httrack



For more information look to www.httrack.com.



No version 1.6.0 for Linux actually... sorry

Install SpiderZilla for

Download SpiderZilla for (88 KB)



A script "skrypt.sh" has to be executable!

$ chmod +x skrypt.sh

(in ~/.mozilla/firefox/profiles/xxxxxxxx.default/extensions/{3cd27e92-1a30-11da-94c6-00e08161165f}/httrack/skrypt.sh)

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


How to wget: To downloading a entire site a site:

wget -crpUL http://wwwwwwwwwwwww





The most important command line options are --limit-rate= and --wait=. You should add --wait=20 to pause 20 seconds between retrievals, this makes sure you are not manually added to a blacklist. --limit-rate defaults to bytes, add K to set KB/s. Example:



wget --wait=20 --limit-rate=20K -r -p -U Mozilla http://www.stupidsite.com/restricedplace.html



Use --no-parent



--no-parent is a very handy option that guarantees wget will not download anything from the folders beneath the folder you want to acquire. Use this to make sure wget does not fetch more than it needs to if just just want to download the files in a folder.



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

Repairing XP in 8 commands

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

Boot PC from XP Installation CD
Go2 Repaire mode:


C: CD ..

C: ATTRIB -H C:\\boot.ini

C:ATTRIB -S C:\\boot.ini

C:ATRIB -R C:\\boot.ini

C: del boot.ini

C: BOOTCFG /Rebuild

/FASTDETECT as an OS Load Option

/NOEXECUTE=OPTIN

C: CHKDSK /R /F

C: FIXBOOT

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



XP repairing mode command:


attrib

batch

bootcfg

cd

chdir

chkdsk

cls

copy

del

delete

dir

disable

diskpart

enable

exit

expand

fixboot

fixmbr

format

help

listsvc

logon

map

md

more

mkdir

rd

ren

rename

rmdir

set

systemroot

ty

-------------------------------------------------

--------------------------------------

-------------------------------

------------------------

tcpkill command:



Use tcpkill command to kill specified in-progress TCP connections. It is useful for libnids-based applications which require a full TCP 3-whs for TCB creation.

Syntax:



tcpkill -i eth0 { expression }

Examples:

(a) Kill all outgoing ftp (port 21) connection:



tcpkill -i eth0 port 21

(b) Kill all all packets arriving at or departing from host 192.168.1.2 (host12.nixcraft.com)



tcpkill host 192.168.1.2

OR



tcpkill host host12.nixcraft.com



(c) To kill all IP packets between 192.168.1.2 and any host except 192.168.1.111, type the following:



tcpkill ip host 192.168.1.2 and not 192.168.1.111



\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

How to mail from command line:


$ mail somewhere@domain.com

Output:

Subject: Hello

Hai,



How are you? Hope so you are fine



Take care



Babai



Vivek

.

Cc:



You need to type . (dot) to send an email. To send contains of file (such as /tmp/message) as mail body then use following command:

$ mail -s 'Hai' somewhere@domain.com < /tmp/message

Please note that above command will NOT route an email if you do not have properly configured MTA/mail server.



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



How to htaccess:


http://www.colostate.edu/~ric/htpass.html



#touch .htaccess



! AuthUserFile /Destiny/www/html/current/phpmyadmin/.htpasswd *

! AuthGroupFile /dev/nul *

! AuthName "Required password" *

! AuthType Basic *

! *

! *

! require valid-user *

!
*

! *

! *

! cd *

! mkdir secret *

! cd secret *

! htpasswd -c .htpasswd pumpkin *

! [ you're prompted for the password for pumpkin] *

! [ if you have other users enter the following. Don't use the -c] *

! htpasswd .htpasswd user2 *

! htpasswd .htpasswd user3 *

! *

! *

! *

! *

! *

! *

! *

*********************************************************************************

IIS Passwd For windows IIS Server



Required:



Download and install IIS Password tools

http://www.15seconds.com/issue/060119.htm

http://www.webwizguide.com/kb/asp_tutorials/installing_iis_winXP_pro.asp

In.... .htaccess file

----------------------------------------------

AuthName Title

AuthUserFile c:\inetpub\wwwroot\test\.htpasswd

Require valid-user



---------------------------------------------

In.... .htpasswd file

admin:HeOzw0BtTfjwY

---------------------------------------------







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

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

// install following packages

[root@mail ~]# yum -y install bzip2-devel zlib-devel gmp-devel curl-devel sendmail-devel



[root@mail ~]# wget http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt

[root@mail ~]# rpm --import RPM-GPG-KEY.dag.txt// import GPG-KEY

[root@mail ~]# rm -f RPM-GPG-KEY.dag.txt

[root@mail ~]# wget http://dag.wieers.com/rpm/packages/clamav/clamav-0.91.2-1.rf.src.rpm

[root@mail ~]# rpm -Uvh clamav-0.91.2-1.rf.src.rpm

�@1:clamav################################ [100%]

warning: user dag does not exist - using root

warning: group dag does not exist - using root

warning: user dag does not exist - using root

warning: group dag does not exist - using root

warning: user dag does not exist - using root

warning: group dag does not exist - using root

[root@mail ~]# cd /usr/src/redhat/SPECS

[root@mail SPECS]# rpmbuild -bb clamav.spec// build RPM

[root@mail SPECS]# cd ../RPMS/i386

[root@mail i386]# rpm -Uvh clamav-db-0.91.2-1.rf.i386.rpm

Preparing...################################ [100%]

�@1:clamav-db################################ [100%]

[root@mail i386]# rpm -Uvh clamav-0.91.2-1.rf.i386.rpm

Preparing...################################ [100%]

�@1:clamav################################ [100%]

[root@ns i386]# cd

[root@mail ~]# vi /etc/freshclam.conf



#NotifyClamd /etc/clamd.conf// line 96: make it comment



[root@mail ~]# freshclam// update policy file

ClamAV update process started at Tue Aug 28 21:50:21 2007

main.cvd is up to date (version: 44, sigs: 133163, f-level: 20, builder: sven)

ERROR: getfile: daily-4016.cdiff not found on remote server (IP: 61.205.61.201)

ERROR: getpatch: Can't download daily-4016.cdiff from db.jp.clamav.net

ERROR: getfile: daily-4016.cdiff not found on remote server (IP: 219.117.246.122)

ERROR: getpatch: Can't download daily-4016.cdiff from db.jp.clamav.net

ERROR: getfile: daily-4016.cdiff not found on remote server (IP: 219.117.246.50)

ERROR: getpatch: Can't download daily-4016.cdiff from db.jp.clamav.net

WARNING: Incremental update failed, trying to download daily.cvd

Downloading daily.cvd [100%]

daily.cvd updated (version: 4088, sigs: 16230, f-level: 21, builder: ccordes)

Database updated (149393 signatures) from db.jp.clamav.net (IP: 219.106.242.51)

// erros like above are shown at the first update, but it's no ploblem



[root@mail ~]# clamscan --infected --remove --recursive /home // try to scan



----------- SCAN SUMMARY -----------

Known viruses: 111194

Engine version: 0.90.2

Scanned directories: 23

Scanned files: 33

Infected files: 0

Data scanned: 0.16 MB

Time: 2.721 sec (0 m 2 s)

[root@mail ~]# wget http://www.eicar.org/download/eicar.com // trual virus

Resolving www.eicar.org... 88.198.38.136

Connecting to www.eicar.org|88.198.38.136|:80... connected.

HTTP request sent, awaiting response... 200 OK

Length: 68 [application/x-msdos-program]

Saving to: `eicar.com'



100%[=======================================>] 68 --.-K/s in 0s



19:26:23 (5.90 MB/s) - `eicar.com' saved [68/68]



[root@mail i386]# clamscan --infected --remove --recursive . // try to scan 2

./eicar.com: Eicar-Test-Signature FOUND

./eicar.com: Removed// removed



----------- SCAN SUMMARY -----------

Known viruses: 111194

Engine version: 0.90.2

Scanned directories: 5

Scanned files: 12

Infected files: 1// just detected

Data scanned: 0.02 MB

Time: 2.599 sec (0 m 2 s)

..........................................

--------------------------------

-------------------------



--------------------

----------

--------







-----------------------------------------------------------------------------------

-----------------------------------------------------------------------------------

How to Build srpm to rpm

=================
Process One (as root):



*****************************************************************

* rpm -Uvh clamav-0.91.2-1.rf.src.rpm *

* cd /usr/src/redhat/SPECS *

* rpmbuild -bb clamav.spec
cd ../RPMS/i386 *

* rpm -Uvh clamav-0.91.2-1.rf.i386.rpm *

*****************************************************************







************************************************************************************

Process no 2 (as normal user):



It is always recommended to build/rebuild an RPM package as a regular, not root, user. You also need to create the RPM build directories. Now login as a regular user and do the following:


mkdir rpmbuild

mkdir rpmbuild/BUILD

mkdir rpmbuild/RPMS

mkdir rpmbuild/RPMS/athlon

mkdir rpmbuild/RPMS/i386

mkdir rpmbuild/RPMS/i486

mkdir rpmbuild/RPMS/i586

mkdir rpmbuild/RPMS/i686

mkdir rpmbuild/RPMS/noarch

mkdir rpmbuild/SOURCES

mkdir rpmbuild/SPECS

mkdir rpmbuild/SRPMS



Now create the file .rpmmacros (look closely it is a dot file, i.e., the filename is preceded by a period) and the content is:

%_topdir /home/username/rpmbuild



Replace username with the actual user account name.



We are now ready to build an RPM package.

Source RPM





If you want to install ClamAV anti-virus program, you may download the RPM package from crash-hat. It also provides a source rpm (.src.rpm). I prefer to download the source RPM and then rebuild it against my own server.



To do this, just execute the following command:

rpmbuild --rebuild clamav-0.83-1.src.rpm



After rebuilding the source RPM, you have the RPM files in:


rpmbuild/RPMS/i386/clamav-0.83-1.i386.rpm

rpmbuild/RPMS/i386/clamav-milter-0.83-1.i386.rpm

rpmbuild/RPMS/i386/clamav-devel-0.83-1.i386.rpm


Source Tarball with spec file



If, for example, you want to install SpamAssassin. No RPM package is made available. But what is provided contains the RPM spec file (Mail-SpamAssassin-3.0.2.tar.bz2 and Mail-SpamAssassin-3.0.2.tar.gz).



How do you know if an RPM spec file is included in the source tarball? Taking the two files above as an example, execute the following:

tar fzt Mail-SpamAssassin-3.0.2.tar.gz | grep .spec

tar fjt Mail-SpamAssassin-3.0.2.tar.bz2 | grep .spec



Build the RPM packaged this way:

rpmbuild -tb Mail-SpamAssassin-3.0.2.tar.gz

rpmbuild -tb --define "srcext .bz2" Mail-SpamAssassin-3.0.2.tar.bz2

Source tarball without spec file



I mentioned above that I do not want to install from source. So, what to do? Install CheckInstall and let it make an RPM for you.



The procedure for creating an RPM program is as follows:

tar xvfz program_name-version.tar.gz

cd program_name-version

./configure

make



Now instead of executing:

make install



Execute instead:

checkinstall

Perl Modules



How I hate perl! It is very difficult to manage the perl module packages installed in your system. I absolutely refuse to install perl modules from source. It has been a cause of many problems. If you upgrade to a newer version from source, you might find that your application does not work anymore.



But I need a particular perl module package. What can I do? For example, we are using OpenWebMail in our school to access our emails. It requires a perl module Text-Iconv. As I do not want to install from source, I searched the Internet and found an RPM perl-Text-Iconv package. I downloaded and installed it. But OpenWebMail was still complaining that it could not find Text-Iconv. After a few days of scratching my head, I found out that the RPM perl-Text-Iconv that I downloaded and installed was compiled against a different version of perl. So it does not work. Now what to do?



I finally found the program cpan2rpm that solved my problem. Download and install it. And then just execute:

cpan2rpm Text-Iconv-1.4.tar.gz



And it will create the following files:

rpmbuild/RPMS/i386/perl-Text-Iconv-1.4-1.i386.rpm

rpmbuild/SRPMS/perl-Text-Iconv-1.4.1.src.rpm



Now you can install the RPM package without any problem.

Fr. Visminlu Vicente L. Chua, S.J.

2005/03/21

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

*******************

* Crontab *

*******************





Min(0-59) Hour(0-23) DayofMonth(1-31) Month(1-12 or Jan-Dec) DayofWeek(0-6 or Sun-Sat) Command



0 2 12 * 0,6 /usr/bin/find



This line executes the "find" command at 2AM on the 12th of every month that a Sunday or Saturday falls on.







EXAMPLE CRON FILE



# use /bin/sh to run commands, no matter what /etc/passwd says

SHELL=/bin/sh



# mail any output to `paul', no matter whose crontab this is

MAILTO=paul

#



# run five minutes after midnight, every day

5 0 * * * $HOME/bin/daily.job >> $HOME/tmp/out 2>&1





# run at 2:15pm on the first of every month -- output mailed to paul

15 14 1 * * $HOME/bin/monthly



# run at 10 pm on weekdays, annoy Joe

0 22 * * 1-5 mail -s "It's 10pm" joe%Joe,%%Where are your kids?%

23 0-23/2 * * * echo "run 23 minutes after midn, 2am, 4am ..., everyday"

5 4 * * sun echo "run at 5 after 4 every sunday"

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

List the running process

$ ps

PID TTY TIME CMD

1293 pts/5 00:00:00 MyProgram



Then Kill it

$ kill 1293

[2]+ Terminated MyProgram



To run a command and then kill it after 5 seconds:



my_command & sleep 5

kill -0 $! && kill $!



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



Examples



grep for pattern in all files on the system:



find / -print | xargs grep pattern > out &



Run diff on file pairs (e.g., f1.a and f1.b, f2.a and f2.b ...):



echo $* | xargs -n2 diff



The previous line would be invoked as a shell script, specifying filenames as arguments.

Display file, one word per line (same as deroff -w):



cat file | xargs -n1



Move files in olddir to newdir, showing each command:



ls olddir | xargs -i -t mv olddir/ newdir/



++===========================================================================

Securing the Firewall

**********************





You should turn off.......

.................echo, discard, daytime, chargen, ftp, gopher, shell, login, exec, talk, ntalk, pop-2, pop-3, netstat, systat, tftp, bootp, finger, cfinger, time, swat and linuxconfig......... if you have one.



To turn a service off, put # as the first character of the service line. When your done, send a SIG-HUP to the process by typing "kill -HUP ", where is the process number of inetd. This will make inetd re-read its configuration file (inetd.conf) and restart without taking your system down.



Test this by telneting to port 15 (netstat) on firewall. If you get any output you have not turned these services off.

telnet localhost 19

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

tar -ztf



will list the contents of the tarball. Now, we'll decompress and untar it.

tar -zxvf openssh-2.7-9.tar.gz



You'll see various things happening on your screen as the tarball is unpacked and unzipped. (A quick note on this--if there is nothing else in the current directory named openssh then you could simply use tar -xzvf openssh* and lazily avoid typing out the version number).

If you now do

ls



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

gzip filename.ext

gzip filename.gz file1 file2 file3 /user/work/school

gunzip filename.ext.gz



zip -r filename.zip files

unzip filename.zip



tar -cvf filename.tar files/directories

tar -cvf foo.tar /home/mine/work /home/mine/school



tar -tvf foo.tar

tar -xvf foo.tar





tar -czvf foo.tar

tar -xzvf foo.tgz



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



***************************************************

tar -zxvf openssh-2.7-9.tar.gz

./configure

make

make install

make clean



*****************************************************

tar -jxvf filename.bz2

tar -yxvf filename.bz2. (If -J is an unknown Option)

bunzip2 filename.bz2 (If above command doesn't work)

tar -xvf filename.tar (If above command doesn't work)



*******************************************************









If the file is a tar.bz2 rather than tar.gz the process is almost the same. However, instead of typing tar -zxvf filename.tar.gzyou would type

tar -jxvf filename.bz2



From there, the rest of the process is identical to installing a .tar.gz as mentioned above, beginning with the step of cd'ing to the newly created directory.

With some distributions of Linux, they're using different versions of bunzip2 and this won't work. You will get a message that -j is an unknown option. If this happens, then try again with

tar -yxvf filename.bz2.

One of these should work, but if neither does then

bunzip2 filename.bz2 && tar -xvf filename.tar



The bunzip2 command decompresses the file. The && means that if the command completed successfully, then perform the following command which in this case is the tar -xvf. (As mentioned above, extract the various parts of the file, with the verbose and file options).

So, once again using our openssh tarball, it'd be



bunzip2 openssh-2.7.9.tar.bz2 && tar -xvf openssh-2.7.9.tar



Lastly, though they're becoming less common, is one with a .tar.Z extension. In this case use

uncompress filename.tar.Z && tar -xvf filename.tar

Once again, you'll have a new directory of the filename without the .tar.Z extension. CD to the new directory and follow the instructions given above.

Note that there are also non-tarred files that are simply compressed. If you have a file called file.bz2 and do tar -jxvf on the file you'll get an error message that it's an inappropriate file type or the like. If the file is called file.bz2 rather than file.tar.bz2 then just decompress it with the appropriate program. If it's a .bz2 file then

bunzip2 file.bz2



If it's a file.gz then substitute gunzip for bunzip2 and if it's just a .Z then the command is uncompress file.Z

From time to time, you might have to open a Microsoft .zip format file. There are zip and unzip utilities. In FreeBSD they're in /usr/ports/archivers/zip and /usr/ports/archivers/unzip. I think that they both install the other as a dependency, but I wouldn't swear to that. Most Linux distributions also have these two utilities available.

Lastly, you might need to know how to collect and compress the files. Lets say you have a bunch of great bash scripts that you want to send your friend as a tarball. They're all in a directory called bashscripts. Again, there are various ways to do it (and some that might be simpler than this) but, like everyone else, I have my habits. So, we're in the directory that houses the directory bashscripts. You're going to tar it into a file called scripts.tar and then compress that file into a tar.bz2 file. (I haven't compressed into a tar.Z in a long time--most distros have bzip2 and gzip, so the following should work)

tar -cf scripts.tar bashscripts && bzip2 scripts.tar



(If your browser broke that, it should be on one line)

If you'd wanted to make a tar.gz file instead you would substitute gzip for bzip2.

tar -cf scripts.tar---this gives the name of the new file, which consists of the files that you tarred together. bashscripts is obviously all the files in the directory bashscripts. && means that if the command completes successfully, go on to the following command. bzip2 compresses the file (as does gzip). When you're done, you'll find that you have a new file called scripts.tar.bz2 ( or scripts.tar.gz)



The other way to do it, at least with most versions of tar (check the man page to see if it's supported) is to compress it as you're tarring it. This can be done with the -j -y or -z option. In FreeBSD, at least, one has to put the j before the cf or it doesn't work, for example

tar -jcf scripts.tar bashscripts



If you do it the first way, tar -cf scripts.tar && bzip2 scripts.tar the .bz2 suffix is appended to the filename, so you would automatically have a file called scripts.tar.bz2. If you do it the second way, with -jcf then the file will be called whatever you chose to call it---in this case, scripts.tar. Doing a file scripts.tar will show that it is a bzipped file. You can manually add the bz2 suffix or call the file that in the original command, e.g.

tar -jcf scripts.tar.bz2 bashscripts



(This can also work with the -z option.)

That's all there is to it. This should get you started.

last modified: Sun, 08 Jan 2006 18:42:10 GMT

url:http://home.nyc.rr.com/computertaijutsu/tarball.html











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

gzip -d



tar xzvf



cd into the folder



./configure



make



checkinstall -S -y

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



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

< The procedure >

The installation procedure for software that comes in tar.gz and tar.bz2 packages isn't always the same, but usually it's like this:

# tar xvzf package.tar.gz (or tar xvjf package.tar.bz2)

# cd package

# ./configure

# make

# make install

If you're lucky, by issuing these simple commands you unpack, configure, compile, and install the software package and you don't even have to know what you're doing. However, it's healthy to take a closer look at the installation procedure and see what these steps mean.

http://www.tuxfiles.org/linuxhelp/softinstall.html



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



Installation Instructions



- Ensure that the .bin file you downloaded is executable. You can make the .bin file executable by running the "chmod a+x RealPlayer10GOLD.bin" command from a terminal window.



- Run the .bin file by typing "./RealPlayer10GOLD.bin". Follow the prompts provided to finish installing the player.



- When you launch the player for the first time, a set-up assistant will take you through configuring your player.



- Enjoy your RealPlayer10 for Linux!



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



What about FC4?

If you are using Fedora Core 4 use these commands to obtain Fedora Frog



wget -c http://easylinux.info/uploads/frog-fc4.tar.gz

tar zxvf frog-fc4.tar.gz -C ~



Run Fedora Frog by

xterm -e ~/.frog/frog.run



















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



Install unrar command



Under Debian Linux, you need to type apt-get as follows to install unrar program:

# apt-get install unrar



If you are using Fedora core Linux then use yum command as follows (see discussion below):

# yum install unrar



If you are using FreeBSD, use:

# pkg_add -v -r unrar



If any of above, methods is not working for you, download binary package from official rarlab site:

$ cd /tmp

$ wget http://www.rarlab.com/rar/rarlinux-3.6.0.tar.gz



Untar file

$ tar -zxvf rarlinux-3.6.0.tar.gz



Both unrar and rar commands are located in rar sub-directory. Just go to rar directory:

$ cd rar

$ ./unrar



Now copy rar and unrar to /bin directory:

# cp rar unrar /bin

How to use unrar



unrar command supports various options below are common options that you need to use everyday.

Task: To open rar (unpack) file in current directory type command:



$ unrar e file.rar



Please note that replace file.rar filename with your actual filename.

Task: List (l) file inside rar archive:



$ unrar l file.rar

Task: To extract (x) files with full path type command:



$ unrar x file.rar



(D) To test (t) integrity of archive, file type command:

$ unrar t file.rar





How do I open rar file under Windows XP/NT/2000?



Windows XP or NT/2000 user

If you are using Windows XP then I recommend to download Winrar. It is free download ( Free to try License) software.









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



*******************************

For auto mount network file *

*******************************



# vi /etc/fstab

Append line //ntserver/docs /mnt/samba smbfs username=docsadm,password=D1Y4×9sw 0 0, at the end your file should read as follows:

proc /proc proc defaults 0 0

/dev/hdb1 / ext3 defaults,errors=remount-ro 0 1

/dev/hdb2 none swap sw 0 0

/dev/hdc /media/cdrom0 iso9660 ro,user,noauto 0 0

//ntserver/docs /mnt/samba smbfs username=docsadm,password=D1Y4x



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



If you are using any other disro type the following command to clear up firewall rules:

# iptables -F

# iptables -X

# iptables -t nat -F

# iptables -t nat -X

# iptables -t mangle -F

# iptables -t mangle -X

# iptables -P INPUT ACCEPT

# iptables -P OUTPUT ACCEPT





www.tldp.org/HOWTO/IP-Masquerade-HOWTO/stronger-firewall-examples.html



+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++





****************************

http://www.vanemery.com/Linux/Jabber/jabadd

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

jabber





2.2. Create Jabber User and Group



You should create a jabber user and group to run the server:



P Parameter: Jabber User and Group

Create a user and group that will be used to run Jabberd (as superuser):



su

groupadd jabber

useradd -g jabber jabber







2.3. Create Directories for PID's and Logs



You should create a directory for Jabberd to store its PID and log files, and ownership of these directories should be set to the user created above.

P Parameter: PID Directory

Create a directory for PID files (as superuser):

su

mkdir -p /usr/local/var/jabberd/pid/

chown -R jabber:jabber /usr/local/var/jabberd/pid/



The above directory is the default location for Jabberd PID files.



You may also choose to create a directory for Jabberd logs.

O Optional: Log Directory

If you wish, create a separate directory for Jabberd logs, and set ownership to your jabber user:

mkdir -p /usr/local/var/jabberd/log/

chown -R jabber:jabber /usr/local/var/jabberd/log





-----------------------------------------------------

tar xvzf jabberd-2.0s11.tar.gz

cd jabberd-2.0s11

./configure --enable-mysql --enable-ssl --enable-idn \--with-extra-include-path=/usr/include/mysql:/usr/include \--with-extra-library-path=/usr/lib/mysql:/usr/lib

make

make install





----------------------------------------------------

If gsasl error then u have to install folowing package



libgsasl

lingsasl-devel





-------------------------------------------------------

create a mysql user (jabberd2) with password.(Using webmin OR PHPMYADMIN)



make jabberd2 jabberd2 database user



create jabberd2 database with PHPMYADMIN



/etc/init.d/jabberd start



u have to open port 5222 to login from internet to server

All done

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

phpMyAdmin 2.10.2 Documentation

''''''''''''''''''''''''''''''''

Requirements



* PHP

o You need PHP 4.1.0 or newer, with session support (see FAQ 1.31)

o You need GD2 support in PHP to display inline thumbnails of JPEGs ("image/jpeg: inline") with their original aspect ratio

o You need PHP 4.3.0 or newer to use the "text/plain: external" MIME-based transformation

* MySQL 3.23.32 or newer (details);

* Not really a requirement but a strong suggestion: if you are using the "cookie" authentication method, having the mcrypt PHP extension on your web server accelerates not only the login phase but every other action that you do in phpMyAdmin.

* Web browser with cookies enabled.

--------------

1.# Choose an appropriate distribution kit from the phpmyadmin.net Downloads page. Some kits contain only the English messages, others contain all languages in UTF-8 format (this should be fine in most situations), others contain all languages and all character sets. We'll assume you chose a kit whose name looks like phpMyAdmin-x.x.x-all-languages.tar.gz.

2.# Untar or unzip the distribution (be sure to unzip the subdirectories): tar -xzvf phpMyAdmin_x.x.x-all-languages.tar.gz in





Instead of manually editing config.inc.php, you can use the Setup Script. First you must manually create a folder config in the phpMyAdmin directory. This is a security measure. On a Linux/Unix system you can use the following commands:



cd phpMyAdmin

mkdir config # create directory for saving

chmod o+rw config # give it world writable permissions



And to edit an existing configuration, copy it over first:



cp config.inc.php config/ # copy current configuration for editing

chmod o+w config/config.inc.php # give it world writable permissions



Next, open scripts/setup.php (https://server2.destiny/phpmyadmin/scripts/setup.php) in your browser. Note that changes are not saved to disk until



Fillup as requirments

...



Once the file has been saved, it must be moved out of the config/ directory and the permissions must be reset, again as a security measure:



mv config/config.inc.php . # move file to current directory

chmod o-rw config.inc.php # remove world read and write permissions

--

Change the folowing line if facing trouble in config.inc.php file

like



$cfg['Servers'][$i]['controluser'] = 'msqladmin';

$cfg['Servers'][$i]['controlpass'] = '';











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

# How to kii a user from logon



run ..





#ps -f -a



Then



kill -9 PPID

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

How to Break CISCO 2600 Password:




When start

ctrl+Pause break

rommon 2 > confreg 0x2142



Router>enable

Router#conf t



Router(config)#enable secret bengal20

Router(config)#exit



Router#show running-config



Router#show version



Router#configure t



Router#show version



Router#copy running-config start

Router#copy running-config startup-config

Destination filename [startup-config]?

Building configuration...

[OK]

Router#config-register 0x2102

Router#write

Router#reload

Router>enable

Password:



Router#show version

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



admin-5>enable

Password:



admin-5#show run



admin-5#conf terminal

admin-5(config)#interface ethernet 0/0



admin-5(config-if)#ip address 192.168.110.150 255.255.255.0



admin-5(config-if)#no shutdown



admin-5(config-if)#exit



admin-5(config)#interface serial 0/0



admin-5(config-if)#ip address 123.49.2.150 255.255.255.252

admin-5(config-if)#no shutdown

admin-5(config-if)#ex



admin-5(config)#exit



admin-5#show running-config





admin-5(config)#interface ethernet 0/0



admin-5(config-if)#ip address 192.168.110.150 255.255.255.0



admin-5(config-if)#no shutdown



admin-5(config)#interface serial 0/0



admin-5(config-if)#ip address 123.49.2.150 255.255.255.252



admin-5(config-if)#no shutdown



admin-5(config)#exit



admin-5#show running-config



admin-5#show ip interface brief



admin-5#configure terminal



admin-5(config)#

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

admin-5>enable

Password:



admin-5#configure terminal



admin-5(config)#ip classless



admin-5#configure terminal



admin-5#ping 123.49.2.150



Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 123.49.2.150, timeout is 2 seconds:



admin-5#configure terminal



admin-5(config)#interface serial 0/0



admin-5(config-if)#clock rate ?

admin-5(config-if)#

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

admin-5(config-if)# interface ethernet 0/0

admin-5(config-if)# ip nat inside



admin-5(config-if)# exit/ctrl+z



admin-5(config-if)# internel serial0/0



admin-5(config-if)# ip nat outside



admin-5(config-if)# ip nat pool destiny 192.168.110.1 192.168.110.255 prefix 24

admin-5(config-if)# ip nat inside source list 7 pool destiny



admin-5(config-if)# access list 7 permit 192.168.110.0 0.0.0.255



admin-5(config-if)# ctrl+z



admin-5(config-if)# write



admin-5(config-if)#

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

When start

ctrl+Pause break

rommon 2 > confreg 0x2142



Router>enable

Router#conf t



Router(config)#enable secret bengal20

Router(config)#exit



Router#show running-config



Router#show version



Router#configure t



Router#show version



Router#copy running-config start

Router#copy running-config startup-config

Destination filename [startup-config]?

Building configuration...

[OK]

Router#config-register 0x2102

Router#write

Router#reload

Router>enable

Password:



Router#show version

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

Command list :
Requirement Cisco Command
Set a console password to cisco
Router(config)#line con 0
Router(config-line)#login
Router(config-line)#password cisco
Set a telnet password Router(config)#line vty 0 4
Router(config-line)#login
Router(config-line)#password cisco
Stop console timing out
Router(config)#line con 0
Router(config-line)#exec-timeout 0 0
Set the enable password to cisco
Router(config)#enable password cisco
Set the enable secret password to peter.

This password overrides the enable password and is encypted within the config file
Router(config)#enable secret peter
Enable an interface
Router(config-if)#no shutdown
To disable an interface
Router(config-if)#shutdown
Set the clock rate for a router with a DCE cable to 64K
Router(config-if)clock rate 64000
Set a logical bandwidth assignment of 64K to the serial interface
Router(config-if)bandwidth 64
Note that the zeroes are not missing
To add an IP address to a interface
Router(config-if)#ip addr 10.1.1.1 255.255.255.0
To enable RIP on all 172.16.x.y interfaces
Router(config)#router rip
Router(config-router)#network 172.16.0.0
Disable RIP
Router(config)#no router rip
To enable IRGP with a AS of 200, to all interfaces
Router(config)#router igrp 200
Router(config-router)#network 172.16.0.0
Disable IGRP
Router(config)#no router igrp 200

Static route the remote network is 172.16.1.0, with a mask of 255.255.255.0, the next hop is 172.16.2.1, at a cost of 5 hops
Router(config)#ip route 172.16.1.0 255.255.255.0 172.16.2.1 5

Disable CDP for the whole router
Router(config)#no cdp run
Enable CDP for he whole router
Router(config)#cdp run
Disable CDP on an interface
Router(config-if)#no cdp enable



Cisco Router Show Commands
Requirement Cisco Command
View version information
#show version

View current configuration (DRAM)
#show running-config

View startup configuration (NVRAM)
#show startup-config

Show IOS file and flash space
#show flash

Shows all logs that the router has in its memory
#show log

View the interface status of interface e0
#show interface e0

Overview all interfaces on the router
#show ip interfaces brief

View type of serial cable on s0
#show controllers 0 (note the space between the 's' and the '0')

Display a summary of connected cdp devices
#show cdp neighbor

Display detailed information on all devices
#show cdp entry *

Display current routing protocols
#show ip protocols

Display IP routing table
#show ip route

Display access lists, this includes the number of displayed matches
#show access-lists

Check the router can see the ISDN switch
#show isdn status

Check a Frame Relay PVC connections
#show frame-relay pvc

show lmi traffic stats
#show frame-relay lmi

Display the frame inverse ARP table
#show frame-relay map

Cisco Router Basic Operations

#Enable Enter privileged mode
Return to user mode from privileged

#disable
Exit Router

#Logout or exit or quit
Recall last command up arrow or
Recall next command down arrow or
Suspend or abort and and 6 then x
Refresh screen output
Compleat Command TAB

Cisco Router Copy Commands
Requirement Cisco Command

Save the current configuration from DRAM to NVRAM
#copy running-config startup-config

Merge NVRAM configuration to DRAM
#copy startup-config running-config

Copy DRAM configuration to a TFTP server
#copy runing-config tftp

Merge TFTP configuration with current router configuration held in DRAM
#copy tftp runing-config

Backup the IOS onto a TFTP server
#copy flash tftp

Upgrade the router IOS from a TFTP server
#copy tftp flash

Cisco Router Debug Commands
Requirement Cisco Command

Enable debug for RIP #debug ip rip

Enable summary IGRP debug information #debug ip igrp events

Enable detailed IGRP debug information #debug ip igrp transactions

Debug IPX RIP #debug ipx routing activity

Debug IPX SAP #debug IPX SAP

Enable debug for CHAP or PAP #debug ppp authentication

Switch all debugging off #no debug all

undebug all

--------------------------------------


CCNP:

CCNP Certification is awarded by Cisco Systems® and signifies the competency achieved in installing, configuring, and operating LAN, WAN, and dial access services in medium to large networks (500+ nodes or more), including use of these protocols: IP, IGRP, EIGRP, IS-IS, BGP, OSPF, Serial, Frame Relay, IP RIP, VLANs, RIP, Ethernet, Access Lists. CCNA is a pre-requisite for CCNP certification. The CCNP certification is awarded after successful completion of the following 4 exams



http://www.simulationexams.com/certification-exams/ccnp-certification.htm

http://www.simulationexams.com/certification-exams/ccna-certification.htm

http://www.ssuet.edu.pk/~amkhan/cisco/cisco.htm



http://www.ssuet.edu.pk/~amkhan/cisco/cisco_ccnp_remote_acsess_exam_certification_guide.pdf


CCNA:

CCNA Certification is awarded by Cisco Systems® and signifies the competency achieved in installing, configuring, and operating LAN, WAN, Wireless LAN and Switched network services for small networks (100 nodes or fewer), including use of these protocols: IP, EIGRP, Serial, and Frame Relay. The certification exams are computer based, and conducted by Sylvan Prometric and VUE testing centers. The certification, being widely recognized, offers improved job prospects in the field of LAN, and WAN infrastructure installation and maintenance using Cisco, and compatible equipment. There are no pre-requisites for taking this exam. The only requirement being payment of exam fee, which is about US$ 125. The CCNA certification is composed of 1 (ONE) individual exam, i.e. CCNA (short form for Cisco Certified Network Associate). The exam code for the CCNA exam is 640-802. The test contains identification and situational questions, in addition to Flash based simulation questions. We have provided several of these questions at appropriate ccna certification pages on this website. Alternatively, you can achieve CCNA certification by taking two exams, namely, CCENT (Cisco Certified Entry Network Technician), and CCNA ICND2 (640-816).

http://www.ssuet.edu.pk/~amkhan/cisco/cisco.htm

http://www.simulationexams.com/certification-exams/ccnp-certification.htm



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

CISCO 2600

admin-5>enable

Password:



admin-5#show run



admin-5#conf terminal

admin-5(config)#interface ethernet 0/0



admin-5(config-if)#ip address 192.168.110.150 255.255.255.0



admin-5(config-if)#no shutdown



admin-5(config-if)#exit



admin-5(config)#interface serial 0/0



admin-5(config-if)#ip address 123.49.2.150 255.255.255.252

admin-5(config-if)#no shutdown

admin-5(config-if)#ex



admin-5(config)#exit



admin-5#show running-config





admin-5(config)#interface ethernet 0/0



admin-5(config-if)#ip address 192.168.110.150 255.255.255.0



admin-5(config-if)#no shutdown



admin-5(config)#interface serial 0/0



admin-5(config-if)#ip address 123.49.2.150 255.255.255.252



admin-5(config-if)#no shutdown



admin-5(config)#exit



admin-5#show running-config



admin-5#show ip interface brief



admin-5#configure terminal



admin-5(config)#

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

admin-5>enable

Password:



admin-5#configure terminal



admin-5(config)#ip classless



admin-5#configure terminal



admin-5#ping 123.49.2.150



Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 123.49.2.150, timeout is 2 seconds:



admin-5#configure terminal



admin-5(config)#interface serial 0/0



admin-5(config-if)#clock rate ?

admin-5(config-if)#

===============================
Clock rate:
For DTE Serial cable you don't need
For DCE Set 64000
-------------------------------------


admin-5(config-if)# interface ethernet 0/0

admin-5(config-if)# ip nat inside



admin-5(config-if)# exit/ctrl+z



admin-5(config-if)# internel serial0/0



admin-5(config-if)# ip nat outside



admin-5(config-if)# ip nat pool destiny 192.168.110.1 192.168.110.255 prefix 24

admin-5(config-if)# ip nat inside source list 7 pool destiny



admin-5(config-if)# access list 7 permit 192.168.110.0 0.0.0.255



admin-5(config-if)# ctrl+z



admin-5(config-if)# write



admin-5(config-if)#

***************************************************************************************





Model: CISCO 2620

Console Cable Required: Cisco Blue Console Cable



Step 1: Power On

Step 2: Press CTRL-BREAK when you see initial memory count.

Step 3: From BootRom Menu type: confreg 0x2142

Step 4: From BootRom Menu type: I

Step 5: Router will reset and load IOS

Step 6: Answer No to Configuration Dialog question.

Step 7: From the Router> Prompt type: en

Step 8: From the Router# Prompt type: wr erase

Step 9: From the Router# Prompt type: reset

Step 9.5: From the Router# Prompt type: reload

Step 10: Press CTRL-BREAK when you see initial memory count.

Step 11: From BootRom Menu type: confreg 0x2102

Step 12: From BootRom Menu type: I

Step 13: Router will reset and load IOS w/Default Settings

Last Updated ( Thursday, 28 September 2006 )

==========================================================
Telnet in CISCO 2600:



http://cit.wta.swin.edu.au/cit/subjects/CITP0045/hawthorn_activities/telnet-access-router.html

http://www.tek-tips.com/viewthread.cfm?qid=30172&page=1

Router>en

Router#config t

Enter configuration commands, one per line.� End with CNTL/Z.

Router(config)#line vty 0 4

Router(config-line)#login

% Login disabled on line 66, until 'password' is set

% Login disabled on line 67, until 'password' is set

% Login disabled on line 68, until 'password' is set

% Login disabled on line 69, until 'password' is set

% Login disabled on line 70, until 'password' is set

Router(config-line)#password console



The last command sets the telnet password as console



3.This will enable telnet access, but it will not be possible to enter the privileged mode that is essential for router configuration



4.To set a password for the use of privileged mode, the enable command is used. In the command below the secret option is used with the enable command because it will save the password in an encrypted form



Router(config)# enable secret student
=========================================================

POSTIX === http://www.knowplace.org/pages/howtos/smtp_gateway_for_multiple_domains_with_postfix.php



Postfix multi domain <>

TO config multi doamin mailing proccess in postfix



under postfix just add domains to your "relay_domains" variable in ur main.cf file



and you're away.

---------------------------

Postfix V2.1 supports a "sender_bcc_maps" function which is a lookup table of sender addresses. If the sender address matches, the right hand side of the lookup table will be added as a BCC to the e-mail. So effectively, you could add each user you wanted to log mail for, in the left hand side of the table. In the right hand side of the table you would list the admin e-mail address you want to send the BCC'ed mail to, so for example:



In /etc/postfix/main.cf add:



sender_bcc_maps = hash:/etc/postfix/sender_bcc



Then edit or create /etc/postfix/sender_bcc in the following format:



locuser1@vitdomain1.com admin@adminsdomain.com

locuser2@vitdomain2.com admin@adminsdomain.com



and run "postmap /etc/postfix/sender_bcc" and "posfix reload".



Basically any mail sent through postfix, with an sender address of locuser1@vitdomain1.com or locuser2@vitdomain2.com would also be BCC'ed to admin@adminsdomain.com.



Just FYI, you can do this based on recipient addresses to, with a similar format table using the "recipient_bcc_maps = hash:/etc/postfix/recipient_bcc" in /etc/postfix/main.cf



-----------------------------

For always sending an automatic bcc in..



postfix:



add the following line in postfix main.cf file



always_bcc = abc@abc.com



Note:Ther's a problem if the abc@abc.com user get an mail from other he may got 2 copy and if

he send a mail also got a copy



Its wiser to use



sender_bcc_maps

and

recipents_bcc_maps

:
You could do this as an LDAP query, but I’ve settled for a more mundane approach and am simply using hash tables.
mailbot:/etc/postfix# vi /etc/postfix/bcc_maps


spam@minigeek.org spam@localdomain.localhost

All mail that goes spam@minigeek.org will have a bcc sent to spam@localdomain.localhost (as you can guess, this won’t work but you could substitute @gmail.com).

Now, you need to create the hash map….
mailbot:/etc/postfix# postmap /etc/postfix/bcc_maps

And tell postfix about it:
mailbot:/etc/postfix# vi /etc/postfix/main.cf


# Don't forget to postmap /etc/postfix/bcc_maps to create the db
sender_bcc_maps = hash:/etc/postfix/bcc_maps
recipient_bcc_maps = hash:/etc/postfix/bcc_maps

In this situation, I’ve used the same maps for both senders and recipients but you can do anything you want - sender is messages sent via Postfix (from address) and recipient is the reciever (to address).

Now all you need to do is to reload the Postfix conf:
mailbot:/etc/postfix# /etc/init.d/postfix reload
Reloading Postfix configuration...done.
mailbot:/etc/postfix#

One thing to take note of, it’s not possible to send the bcc to more than one people (unless you use an alias), so don’t even bother! If you don’t care who the email goes to/comes from and you just want a copy of all the mail saved, then you can simply edit main.cf:
mailbot:/etc/postfix# vi /etc/postfix/main.cf


always_bcc=bcc@localhost.localdomain

and reload the postfix conf:
mailbot:/etc/postfix# /etc/init.d/postfix reload
Reloading Postfix configuration...done.
mailbot:/etc/postfix#

----------------------------------

For sendmail (MTA:

To send a cc of all emails to postmaster.

Just add a procmail recipe to /etc/procmail that looks like this:

Code:



:0c

!postmaster



That will forward the mail to postmaster. If I were to do this, I'd prefer that procmail would create a maildir archive, though, like this:

Code:



:0c

/root/mailarchive/



You also need to create the /root/mailarchive directory in that case.







For Qmail:

The simplest way is to modify control/defaultdelivery file.
Usually you have ./.maildir/ there.
Just add additional line abc@abc.com
But for obvious reason abc.com cannot be in domains handled by the qmail.
If so use direct placement in the form /abc/.maildir/

Note: I am not sure for that

-----------------------------------------
How to Resend postfix queued mail /deffered mail:

postfix flush
postqueue -f





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



ntop : Network monitoring tools

Prerequisites:



Ntop 3.2

LIBPCAP

GDBM

Links:

http://dag.wieers.com/rpm/packages/ntop

http://rpmfind.net/linux/RPM/fedora/4/i386/glib-1.2.10-16.i386.html

ftp://rpmfind.net/linux/fedora/core/updates/4/i386/openssl097a-0.9.7a-3.1.i386.rpm



Installation--------



1- Installing G-LIB:

root@admin-3#rpm -ivh glib-1.2.10-16.i386.rpm



2- Installing ntop:

root@admin-3#rpm -ivh ntop-3.2-1.el4.rf.i386.rpm



3- Installing openssl:

root@admin-3# rpm -ivh openssl097a-0.9.7a-3.1.i386.rpm



Running ntop



1- Initialize ntop:



root@admin-3#ntop



That will initialize ntop and it will ask you to enter your username and password.



The default username: admin



Password: xxxx



2- Start ntop service:



service ntop start





Log In To The Web Interface



ntop can be managed through a web interface. You can enter your server address in your web browser:



http://ServerIP:3000



https://ServerIP:3001



Now you can monitor your hosts and manage your ntop configuration.



---------------------------------------------------------------------------------------------

How to swat:



install the package



#vi /etc/xinet.d/swat

service swat

{

port = 901

socket_type = stream

wait = no

only_from = 127.0.0.1 192.168.0.0/24

user = root

server = /usr/sbin/swat

log_on_failure += USERID

disable = no

}

#service xinetd restart



---------------------------------------------------------------





-----------------------------------------------

squid: proxy server





# Important

http_port 3128 transparent



acl destiny src 192.168.0.0/24

http_access allow destiny



# And finally deny all other access to this proxy

http_access allow localhost

http_access deny all



#more inf.

http://www.stocksy.co.uk/files/squid/squid.conf

http://www.stocksy.co.uk/articles/Mac/squid_on_mac_os_x_with_ad_blocking/

---------------------------------------------





---------------------------------------------------------------







Howto: Squid proxy authentication using ncsa_auth helper





For fine control you may need to use Squid proxy server authentication. This will only allow authorized users to use proxy server.



You need to use proxy_auth ACLs to configure ncsa_auth module. Browsers send the user’s authentication in the Authorization request header. If Squid gets a request and the http_access rule list gets to a proxy_auth ACL, Squid looks for the Authorization header. If the header is present, Squid decodes it and extracts a username and password.



However squid is not equipped with password authentication. You need to take help of authentication helpers. Following are included by default in most squid and most Linux distros:

=> NCSA: Uses an NCSA-style username and password file.

=> LDAP: Uses the Lightweight Directory Access Protocol

=> MSNT: Uses a Windows NT authentication domain.

=> PAM: Uses the Linux Pluggable Authentication Modules scheme.

=> SMB: Uses a SMB server like Windows NT or Samba.

=> getpwam: Uses the old-fashioned Unix password file.

=> SASL: Uses SALS libraries.

=> NTLM, Negotiate and Digest authentication

Configure an NCSA-style username and password authentication



I am going to assume that squid is installed and working fine.



Tip: Before going further, test basic Squid functionality. Make sure squid is functioning without requiring authorization

Step # 1: Create a username/password



First create a NCSA password file using htpasswd command. htpasswd is used to create and update the flat-files used to store usernames and password for basic authentication of squid users.

# htpasswd /etc/squid/passwd user1



Output:

New password:

Re-type new password:

Adding password for user user1



Make sure squid can read passwd file:

# chmod o+r /etc/squid/passwd

Step # 2: Locate nsca_auth authentication helper



Usually nsca_auth is located at /usr/lib/squid/ncsa_auth. You can find out location using rpm (Redhat,CentOS,Fedora) or dpkg (Debian and Ubuntu) command:

# dpkg -L squid | grep nsca_auth



Output:

/usr/lib/squid/ncsa_auth



If you are using RHEL/CentOS/Fedora Core or RPM based distro try:

# rpm -ql squid | grep nsca_auth



Output:

/usr/lib/squid/ncsa_auth

Step # 3: Configure nsca_auth for squid proxy authentication



Now open /etc/squid/squid.conf file

# vi /etc/squid/squid.conf



Append (or modify) following configration directive:

auth_param basic program /usr/lib/squid/ncsa_auth /etc/squid/passwd

auth_param basic children 5

auth_param basic realm Squid proxy-caching web server

auth_param basic credentialsttl 2 hours

auth_param basic casesensitive off



Also find out your ACL section and append/modify

acl ncsa_users proxy_auth REQUIRED

http_access allow ncsa_users



Save and close the file.



Where,

auth_param basic program /usr/lib/squid/ncsa_auth /etc/squid/passwd : Specify squid password file and helper program location

auth_param basic children 5 : The number of authenticator processes to spawn.

auth_param basic realm Squid proxy-caching web server : Part of the text the user will see when prompted their username and password

auth_param basic credentialsttl 2 hours : Specifies how long squid assumes an externally validated username:password pair is valid for - in other words how often the helper program is called for that user with password prompt. It is set to 2 hours.

auth_param basic casesensitive off : Specifies if usernames are case sensitive. It can be on or off only

acl ncsa_users proxy_auth REQUIRED : The REQURIED term means that any authenticated user will match the ACL named ncsa_users

http_access allow ncsa_users : Allow proxy access only if user is successfully authenticated.



Restart squid:

# /etc/init.d/squid restart



Now user is prompted for username and password.





-------------------------------------------------



Delete undeleteble file in XP:

http://www.softwarepatch.com/tips/howto-delete-xp.html

http://www.softwarepatch.com/network-security/moveonboot-security.html

Use this utility to delete the file when windows start.

-------------------------------------------------------

DNS with system-config-bind:

To configure the DNS server, login or become root and run the command

Code:

root#system-config-bind



If it cannot find the command, you will have to install the package

Code:

root#yum install system-config-bind



Then start defining your zones. You will need both a foward zone to resolve host names to IP addresses and a reverse zone to resolve IP addresses to hostnames.



01. Forward zone:

To create a new forward zone,

just click on the "New" icon and choose "Zone" from the menu. For the forward zone, choose the option for "IN Internet" type, then "Forward". Enter your domain name followed by a period (ie. mydomain.com.) and choose Master for the zone type. That will make it to where your DNS is authoritative for your domain name.





02. Reverse Zone:

After that, create the IPv4 reverse zone.

Again click on the "New" icon and choose "Zone". Click OK for "IN Internet" then choose "IPv4 Reverse" for the origin type. In the box that appears, type the first octet of your static IP address (the 192 in 192.168.1.1) then click Add. Repeat that for the next two octets. For Zone type, choose "Master" again and click OK.



03.Adding hosts to the server:



To do this, right click on the forward zone name and choose the type of record you want to add. Each host should get an "A" record if you want users to be able to resolve their name using the DNS server. Enter the requested information in the window that appears. Ensure the option to "Create a reverse mapping" is selected and click ok. Once you have all of your entries done, click the "Save" icon to save our configuration and then exit the program. The named daemon will restart automatically and reload your new configuration.



You will also need someone to host you domain name on a server for you. Your ISP might be able to do this for you, if not dyndns.org can - for a small fee. I have been using them for years without a problem. There are others out there though. What they do is point DNS queries for your domain to your DNS server.



Hope this helps. If you don't want to use the GUI as I described above, there is always the manual way, but I will let someone explain that.

-----------------------------------------



How to compiling Kernel:



This is for debian-linux:

Step # 1 Get Latest Linux kernel code



Visit http://kernel.org/ and download the latest source code. File name would be linux-x.y.z.tar.bz2, where x.y.z is actual version number. For example file inux-2.6.23.tar.bz2 represents 2.6.23 kernel version. Use wget command to download kernel source code:

$ cd /tmp

$ wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-x.y.z.tar.bz2



Note: Replace x.y.z with actual version number.

Step # 2 Extract tar (.tar.bz3) file



Type the following command:

# tar -xjvf linux-2.6.23.tar.bz2 -C /usr/src

# cd /usr/src

Step # 3 Configure kernel



Before you configure kernel make sure you have development tools (gcc compilers and related tools) are installed on your system. If gcc compiler and tools are not installed then use apt-get command under Debian Linux to install development tools.

# apt-get install gcc



Now you can start kernel configuration by typing any one of the command:

$ make menuconfig - Text based color menus, radiolists & dialogs. This option also useful on remote server if you wanna compile kernel remotely.

$ make xconfig - X windows (Qt) based configuration tool, works best under KDE desktop

$ make gconfig - X windows (Gtk) based configuration tool, works best under Gnome Dekstop.



For example make menuconfig command launches following screen:

$ make menuconfig



You have to select different options as per your need. Each configuration option has HELP button associated with it so select help button to get help.

Step # 4 Compile kernel



Start compiling to create a compressed kernel image, enter:

$ make



Start compiling to kernel modules:

$ make modules



Install kernel modules (become a root user, use su command):

$ su -

# make modules_install

Step # 5 Install kernel



So far we have compiled kernel and installed kernel modules. It is time to install kernel itself.

# make install



It will install three files into /boot directory as well as modification to your kernel grub configuration file:

System.map-2.6.23

config-2.6.23

vmlinuz-2.6.23

Step # 6: Create an initrd image



Type the following command at a shell prompt:

# cd /boot

# mkinitrd -o initrd.img-2.6.23 2.6.23



initrd images contains device driver which needed to load rest of the operating system later on. Not all computer requires initrd, but it is safe to create one.

Step # 7 Modify Grub configuration file - /boot/grub/menu.lst



Open file using vi:

# vi /boot/grub/menu.lst

title Debian GNU/Linux, kernel 2.6.23 Default

root (hd0,0)

kernel /boot/vmlinuz root=/dev/hdb1 ro

initrd /boot/initrd.img-2.6.23

savedefault

boot



Remember to setup correct root=/dev/hdXX device. Save the file. If you think editing and writing all lines by hand is too much for you then try out update-grub command to update the lines for each kernel in /boot/grub/menu.lst file. Just type command:

# update-grub



Neat. Huh?

Step # 8 : Reboot computer and boot into your new kernel



Just issue reboot command:

# reboot



http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

------------------------------

How to: Compile Linux kernel modules







This is one the essential and important task. Many time we upgrade our kernel and some precompiled drivers won’t work with Linux. Especially if you have weird hardware; then vendor may send you driver code aka C files to compile. Or even you can write your own Linux kernel driver. Compiling kernel driver is easy. Kernel 2.6.xx makes it even much more easier. Following steps are required to compile driver as module:



1) You need running kernel source code; if you don’t have a source code download it from kernel.org. Untar kernel source code (tar ball) in /usr/src using tar command:

$ tar -zxvf kernel* -C /usr/src



To be frank kernel headers are more than sufficient to compile kernel modules / drivers. See how to install kernel headers under Debian / Ubuntu Linux or RHEL / CentOS / Fedora Linux.



2) Next go to your kernel module source code directory and simply create the Makefile file as follows (assuming your kernel module name is foo):

$ vi Makefile



3) Add following text to it:

obj-m = foo.o

KVERSION = $(shell uname -r)

all:

make -C /lib/modules/$(KVERSION)/build M=$(PWD) modules

clean:

make -C /lib/modules/$(KVERSION)/build M=$(PWD) clean



4) Compile module using make command (module build can be done by any user) :

$ make



It will finally creates the foo.ko module in current directory. You can see all actual compile command stored in .foo* files in same directory.



5) Once module compiled successfully, load it using insmod or modprobe command. You need to be root user or privileged user to run insmod:

# insmod foo.ko

Example: hello.c module



1) hello.c C source code. Copy following code and save to hello.c

$ mkdir demo; cd demo

$ vi hello.c



2)Add following c source code to it:

#include /* Needed by all modules */

#include /* Needed for KERN_INFO */

#include /* Needed for the macros */



static int __init hello_start(void)

{

printk(KERN_INFO "Loading hello module...\n");

printk(KERN_INFO "Hello world\n");

return 0;

}



static void __exit hello_end(void)

{

printk(KERN_INFO "Goodbye Mr.\n");

}



module_init(hello_start);

module_exit(hello_end);



This is an example modified from original source for demonstration purpose.



3) Save the file. Create new Makefile as follows:

$ vi Makefile



Append following make commands:

obj-m = hello.o

KVERSION = $(shell uname -r)

all:

make -C /lib/modules/$(KVERSION)/build M=$(PWD) modules

clean:

make -C /lib/modules/$(KVERSION)/build M=$(PWD) clean



4) Save and close the file.



5) Compile hello.c module:

$ make



6) Become a root user (use su or sudo) and load the module:

$ su -

# insmod hello.ko



Note you can see message on screen if you are logged in as root under run level 3.



7) Verify that module loaded:

# lsmod | less



See message in /var/log/message file:

# tail -f /var/log/message



9) Unload the module:

# rmmod hello



10) Load module when Linux system comes up. File /etc/modules use to load kernel boot time. This file should contain the names of kernel modules that are to be loaded at boot time, one per line. First copy your module to /lib/modules/$(uname -r)/kernel/drivers. Following are suggested steps:



(a) Create directory for hello module:

# mkdir -p /lib/modules/$(uname -r)/kernel/drivers/hello



(b) Copy module:

# cp hello.ko /lib/modules/$(uname -r)/kernel/drivers/hello/



(c) Edit /etc/modules file under Debian Linux:

# vi /etc/modules



(d) Add following line to it:

hello



(e) Reboot to see changes. Use lsmod or dmesg command to verify module loaded or not.

# cat /proc/modules



OR

# lsmod | less

============================================================
How to recompile kernel:
part2:

http://www.digitalhermit.com/linux/Kernel-Build-HOWTO.html

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


How to recompile kernel: (Centos way)

Download the latest kernel with patch :ftp://ftp.kernel.org/pub/linux/kernel/v2.6/

cd /usr/src
wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.18.3.tar.bz2

tar xjf linux-2.6.18.3.tar.bz2
ln -s linux-2.6.18.3 linux
cd /usr/src/linux

#make 1 line comment
vi /etc/modprobe.conf
# alias scsi_hostadapter1 mptscsi

##apply patch If .bz2
bzip2 -dc /usr/src/patch.bz2 | patch -p1
OR
##apply patch If .gz
gunzip -c /usr/src/patch.gz | patch -p1 --dry-run
gunzip -c /usr/src/patch.gz | patch -p1

make clean && make mrproper
cp /boot/config-`uname -r` ./.config
make menuconfig
(Load an alternative configuration file) # To load current change# and change as per as ur req.
save.

make rpm


ls -l /usr/src/redhat/SRPMS/
ls -l /usr/src/redhat/RPMS/i386/
cd /usr/src/redhat/RPMS/i386/
rpm -ivh --nodeps kernel-2.6.18.3default-1.i386.rpm

mkinitrd /boot/initrd-2.6.18.3-default.img 2.6.18.3-default
vi /boot/grub/menu.lst (add the new kernel)
reboot
:
http://www.howtoforge.com/kernel_compilation_centos
-----------------------------------------------

OR



How to recompile kernel:

Download the latest kernel with patch :ftp://ftp.kernel.org/pub/linux/kernel/v2.6/

cd /usr/src
wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.18.3.tar.bz2

tar xjf linux-2.6.18.3.tar.bz2
ln -s linux-2.6.18.3 linux
cd /usr/src/linux

#make 1 line comment
vi /etc/modprobe.conf
# alias scsi_hostadapter1 mptscsi

##apply patch
bzip2 -dc /usr/src/patch.bz2 | patch -p1

make clean && make mrproper
cp /boot/config-`uname -r` ./.config
make menuconfig
(Load an alternative configuration file) # To load current change# and change as per as ur req.
save.

make all
make modules_install
make install


Now you should see your new kernel in /boot/grub/menu.1st file
Just make your new kernel boot


reboot
:
http://www.howtoforge.com/kernel_compilation_centos

-----------------------------

Samba webconfoguration tools



yum install samba-swat

-----------------------------

tcpdump -i eth1

-------------------

Dymo Turbo 330 Label Printer



-------------------------------

Wireshark:



Wireshark is a network traffic analyzer for Unix-ish operating systems.



This package lays base for libpcap, a packet capture and filtering

library, contains command-line utilities, contains plugins and

documentation for wireshark. A graphical user interface is packaged

separately to GTK+ package.

------------------------------------



timetrex:

0 */1 * * * php -q /home/web/public_html/timetrex/maint/cron.php > /dev/null



This seems very strange, according to that error message it can't find or read:

/home/web/public_html/timetrex/maint/TimeClockSync.php

---

http://forums.timetrex.com/viewtopic.php?t=659&highlight=cron+php

------------------------





Enabling/Disabling Compiz from command line



To disable Compiz on the command line:



gconftool-2 –type string –set /apps/gnome-session/rh/window_manager “metacity”



To enable:



gconftool-2 –type string –set /apps/gnome-session/rh/window_manager “compiz”



------------------------------------------------------------------------------

Determine a Directory SIze:



#du -hs /path/

-------------------------------------

#Installing trutype fonts in linux



$ sudo mkdir /usr/share/fonts/myfonts



Then open your terminal to install them:



$ sudo cp /home/user/Desktop/*.ttf /usr/share/fonts/myfonts/

#This command may req.



$mkfontdir



and refresh your font cache like this:

$ sudo fc-cache -f



http://www.smorgasbord.net/installing-windows-ttf-true-type-fonts-in-linux/

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



Mount Linux Partition in windows:



See the ...

http://www.codejacked.com/automatically-mount-your-linux-partition-in-windows/

Just download (http://sourceforge.net/project/downloading.php?groupname=ext2fsd&filename=Ext2Fsd-0.39.exe&use_mirror=nchc)the software and

install it on your PC.

Run it and show the path to mount.



or

see this

http://www.fs-driver.org/index.html

-------------------------------------------------------

English error:

http://wsu.edu/~brians/errors/errors.html#errors

-------------------------------------------------------



Wireless LAN in linux:



Install livna resiperatory..

http://rpm.livna.org/rlowiki/



yum install madwifi madwifi-kmdl-2.6.21-1.3194.fc7

Reboot



use GUI wireless tools to make my wireless card work (configuring)



http://madwifi.org/wiki/UserDocs/Distro/RedHat



http://www.linuxquestions.org/questions/linux-wireless-networking-41/how-to-install-d-link-dwl-g-520-wireless-lan-in-fc7-639753/

----------------------------------------------------------------------

How to install wireless drivers for linux Ndiswrapper:

apt-get install wireless-tools
apt-get install kernel-headers-2.6.8-2-386 (current kernel)
apt-get install linux-headers-`uname -r` build-essential

preparing your windows wireless drivers

* you will need the .sys and .inf files for your wireless driver. Usually in

C:/WINDOWS/system32/


apt-get install ndiswrapper-utils ndiswrapper-source
module-assistant auto-install ndiswrapper
ndiswrapper -i .inf
# Check if installed correctly
ndiswrapper -l
#load the ndiswrapper kernel module
modprobe ndiswrapper
#for your kernel to load this module at boottime
ndiswrapper -m

ifconfig wlan0 up
iwconfig wlan0 essid key
#get IP address from the wireless DHCP server
dhclient
----------------------======================--------------------------


ddrescue:

#ddrescue /dev/sda1 /d1/backup.iso

--------------------------------------------------------

Mount iso image in folder:

mount -o loop /d1/backup.iso /d1/backup/

-----------------------------------------------------





----------------------------------------------------------

Fedora Core : Installation, Bugs/Fixes



Yum Configuration:



* All baseurl lines are commented by default. Yum will throw an error 'cannot fine valid baseurl...'

Yum repo files are in “/etc/yum.repos.d”. Remove '#' sign before the baseurl line in all files.



* Install repo file of Freshrpms.net repository from here....



http://ftp.freshrpms.net/pub/freshrpms/fedora/linux/6/freshrpms-release/freshrpms-release-1.1-1.fc.noarch.rpm



A lot of other repositories are available for FC....



* GUI of Yum ( Yum Extender ).

Code:



yum -y install yumex





Package for playing mp3, mpeg and .dat files:



Fedora does not support these out of box. I prefer 'xmms' for mp3 and xine for mpeg, .dat files.

Code:



yum -y install xmms xmms-mp3

yum -y install xine xine-lib xine-skins



Flash :

Code:



yum -y install flash-plugin



OR download Flash 9 beta from here.....

http://www.adobe.com/products/flashplayer/productinfo/instructions/





Install NTFS Write Support:

Note: ntfs-3g package is pre-installed in Fedora 7. skip install ntfs-3g section.

Install ntfs-3g :

Code:



su -

yum -y install ntfs-3g



It will install ntfs-3g, fuse, and fuse-libs.



Now create a folder to be used as 'mount point' for NTFS partition.

Code:



mkdir /mnt/ntfs_p



Edit /etc/fstab file so the partition is mounted at startup

Code:



su -

vi /etc/fstab



/dev/sda1 /mnt/ntfs_p ntfs-3g defaults,umask=0 0 0



/dev/sda1 might not be the correct partition, depending on your setup. check it...

Code:



/sbin/fdisk -l



Change SELinux to "Permissive Mode" in order for ntfs-3g to work properly at startup.

Code:



vi /etc/selinux/config

SELINUX=permissive



Save and reboot. You should be able to read and write to your NTFS partition now.





BUGS/Fixes







* Add/Remove ( pirut ) doesn't work with DVD/CDs.



Put '#' sign before first baseurl line in three files fedora-core.repo, fedora-extras.repo and fedora-updates.repo in folder /etc/yum.repos.d



#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/core/$releasever/$basearch/os/

add new line below it.

Code:



baseurl=file:///media/disk



---- create a folder 'disk' in /media

Code:



mkdir /media/disk



---- insert Fedora Core DVD and mount it

Code:



mount /dev/hdc /media/disk



---- clean 'yum' cache.

Code:



yum clean all



click on Add/Remove Softwares and install packages from DVD. for installing from internet again, put '#' sign before disk's 'baseurl' line and remove '#' before original 'baseurl' line.





rpmdb: PANIC: fatal region error detected; run recovery



Its a BUG in latest Yum. it is corrupting rpm database on upgrading system.

execute this command as 'root'

Code:



rpm --rebuilddb



this command will rebuild the rpm database. try to upgrade again.





----------------------------------------------------------------------------------







mplayer: Play All Mp3 Files In Reverse Order



Posted: 06 May 2008 06:23 PM CDT



mplayer lacks an option for selecting files in a reverse order. So here is a quick way to playback all mp3 files in reverse order:

$ ls -1 -r *.mp3 > mp3.rev

$ mplayer -playlist mp3.rev

Where,



* -r reverse order while sorting

* -1 list one file per line

* -playlist file : Play files according to a playlist file







--------------------------------------------------------------------------


Turn on vsftpd ftp service

Type the following command:
# chkconfig vsftpd on
How do I start vsftpd ftp server?

Type the following command:
# service vsftpd start
How do I stop vsftpd ftp server?

Type the following command:
# service vsftpd stop
How do I restart vsftpd ftp server?

Type the following command:
# service vsftpd restart
Open FTP port

Open /etc/sysconfig/iptables file, enter:
# vi /etc/sysconfig/iptables
Append following line to open ftp port 21 before REJECT line:
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 21 -j ACCEPT
Save and close the file. Restart the firewall:
# service iptables start
Test ftp server

Type the following command:
$ ftp localhost
$ ftp ftp.server.com
$ ftp 202.54.1.1
How do I configure vsftpd server?

The default configuration file is /etc/vsftpd/vsftpd.conf file. You can open file with vi text editor:
# vi /etc/vsftpd/vsftpd.conf
See see vsftpd.conf man pages for all configuration options.
$ man vsftpd.conf
======================================================================
utube video downloader....:
http://www.orbitdownloader.com/How-to-Download-YouTube-Video.htm

http://www.youtube.com/watch?v=YWwCu94Asrc

http://www.hiphopmusic.com/best_of_youtube/2006/02/how_to_download_and_save_youtu.html
----------------------------------------------------------------------------------------------
List out your last update with rpm

* Read #General Notes

rpm -qa --last | tac
======================================
Fedora "How to"
http://www.fedoraguide.info/index.php/Main_Page

=============================
IMAP With dovecot:
Mail server (dovecot)

* Read #General Notes

su -c 'yum install dovecot'

* Make sure it comes up on boot (Run the command as root)

chkconfig dovecot on

POP/IMAP settings

* Edit the dovecot.conf file

su -c 'gedit /etc/dovecot.conf'

* Modify the following lines
* What type of server do you want it will set the options for imap or pop3 If you want pop remove the imap and imaps.

protocols = imap imaps pop3 pop3s

* Dovecot should listen on the standard ports

listen = [::]

* Set the mail location. The example below creates in your home directory a mail folder called Maildir

# mail_location = maildir:~/Maildir
# mail_location = mbox:~/mail:INBOX=/var/mail/%u
# mail_location = mbox:/var/mail/%d/%1n/%n:INDEX=/var/indexes/%d/%1n/%n
maildir:~/Maildir

=====================================================================================
How to remount /etc/fstab without rebooting

* Read #General Notes

su -c 'mount -a'

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

undo tab + firefox= Shift+ctrl+t

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


What is MySQL

MySQL is a database. A database defines a structure for storing information.

In a database, there are tables. Just like HTML tables, database tables contain rows, columns, and cells.

Databases are useful when storing information categorically. A company may have a database with the following tables: "Employees", "Products", "Customers" and "Orders".
============================================================

What is PHP?

* PHP stands for PHP: Hypertext Preprocessor
* PHP is a server-side scripting language, like ASP
* PHP scripts are executed on the server
* PHP supports many databases (MySQL, Informix, Oracle, Sybase, Solid, PostgreSQL, Generic ODBC, etc.)
* PHP is an open source software (OSS)
* PHP is free to download and use

What is a PHP File?

* PHP files may contain text, HTML tags and scripts
* PHP files are returned to the browser as plain HTML
* PHP files have a file extension of ".php", ".php3", or ".phtml"

What is MySQL?

* MySQL is a small database server
* MySQL is ideal for small and medium applications
* MySQL supports standard SQL
* MySQL compiles on a number of platforms
* MySQL is free to download and use

PHP + MySQL

* PHP combined with MySQL are cross-platform (means that you can develop in Windows and serve on a Unix platform)

Why PHP?

* PHP runs on different platforms (Windows, Linux, Unix, etc.)
* PHP is compatible with almost all servers used today (Apache, IIS, etc.)
* PHP is FREE to download from the official PHP resource: http://www.php.net/
* PHP is easy to learn and runs efficiently on the server side

Where to Start?

* Install an Apache server on a Windows or Linux machine
* Install PHP on a Windows or Linux machine
* Install MySQL on a Windows or Linux machine

http://www.codedcode.com/php/php-introduction.asp
-----------------------------------------------------------

IP MASQUEARDEING:

echo "1" > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o -eth0 -J MASQUERADE


-------------------------------------------------------

Reactivating WIndows XP:

Go to the C:\Windows\System32 folder

Find the files "wpa.dbl" and "wpa.bak" and copy them to a safe location

After Reinstalling XP Just replace these file in same location in safe mode.

Note: It only works if XP reinstalled in same computer.
===========================================================================================================================

How to RAID in Linux:

Configure RAID In Single User Mode

As you will be modifying the disk structure of your system, you should also consider configuring RAID while your system is running in single-user mode from the VGA console. This makes sure that most applications and networking are shutdown and that no other users can access the system, reducing the risk of data corruption during the exercise.

[root@bigboy tmp]# init 1

Once finished, issue the exit command, and your system will boot in the default runlevel provided in the /etc/inittab file.
Configuring Software RAID

Configuring RAID using Fedora Linux requires a number of steps that need to be followed carefully. In the tutorial example, you'll be configuring RAID 5 using a system with three pre-partitioned hard disks. The partitions to be used are:

/dev/hde1
/dev/hdf2
/dev/hdg1

Be sure to adapt the various stages outlined below to your particular environment.
RAID Partitioning

You first need to identify two or more partitions, each on a separate disk. If you are doing RAID 0 or RAID 5, the partitions should be of approximately the same size, as in this scenario. RAID limits the extent of data access on each partition to an area no larger than that of the smallest partition in the RAID set.
Determining Available Partitions

First use the fdisk -l command to view all the mounted and unmounted filesystems available on your system. You may then also want to use the df -k command, which shows only mounted filesystems but has the big advantage of giving you the mount points too.

These two commands should help you to easily identify the partitions you want to use. Here is some sample output of these commands.

[root@bigboy tmp]# fdisk -l

Disk /dev/hda: 12.0 GB, 12072517632 bytes
255 heads, 63 sectors/track, 1467 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 13 104391 83 Linux
/dev/hda2 14 144 1052257+ 83 Linux
/dev/hda3 145 209 522112+ 82 Linux swap
/dev/hda4 210 1467 10104885 5 Extended
/dev/hda5 210 655 3582463+ 83 Linux
...
...
/dev/hda15 1455 1467 104391 83 Linux
[root@bigboy tmp]#

[root@bigboy tmp]# df -k
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/hda2 1035692 163916 819164 17% /
/dev/hda1 101086 8357 87510 9% /boot
/dev/hda15 101086 4127 91740 5% /data1
...
...
...
/dev/hda7 5336664 464228 4601344 10% /var
[root@bigboy tmp]#

Unmount the Partitions

You don't want anyone else accessing these partitions while you are creating the RAID set, so you need to make sure they are unmounted.

[root@bigboy tmp]# umount /dev/hde1
[root@bigboy tmp]# umount /dev/hdf2
[root@bigboy tmp]# umount /dev/hdg1


Prepare The Partitions With FDISK

You have to change each partition in the RAID set to be of type FD (Linux raid autodetect), and you can do this with fdisk. Here is an example using /dev/hde1.

[root@bigboy tmp]# fdisk /dev/hde
The number of cylinders for this disk is set to 8355.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)

Command (m for help):

Use FDISK Help

Now use the fdisk m command to get some help:

Command (m for help): m
...
...
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
...
...
Command (m for help):

Set The ID Type

Partition /dev/hde1 is the first partition on disk /dev/hde. Modify its type using the t command, and specify the partition number and type code. You also should use the L command to get a full listing of ID types in case you forget. In this case, RAID uses type fd, it may be different for your version of Linux.

Command (m for help): t
Partition number (1-5): 1
Hex code (type L to list codes): L


...
...
...
16 Hidden FAT16 61 SpeedStor f2 DOS secondary
17 Hidden HPFS/NTF 63 GNU HURD or Sys fd Linux raid auto
18 AST SmartSleep 64 Novell Netware fe LANstep
1b Hidden Win95 FA 65 Novell Netware ff BBT
Hex code (type L to list codes): fd
Changed system type of partition 1 to fd (Linux raid autodetect)

Command (m for help):

Make Sure The Change Occurred

Use the p command to get the new proposed partition table:

Command (m for help): p

Disk /dev/hde: 4311 MB, 4311982080 bytes
16 heads, 63 sectors/track, 8355 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes

Device Boot Start End Blocks Id System
/dev/hde1 1 4088 2060320+ fd Linux raid autodetect
/dev/hde2 4089 5713 819000 83 Linux
/dev/hde4 6608 8355 880992 5 Extended
/dev/hde5 6608 7500 450040+ 83 Linux
/dev/hde6 7501 8355 430888+ 83 Linux

Command (m for help):


Save The Changes

Use the w command to permanently save the changes to disk /dev/hde:

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.

[root@bigboy tmp]#

The error above will occur if any of the other partitions on the disk is mounted.
Repeat For The Other Partitions

For the sake of brevity, I won't show the process for the other partitions. It's enough to know that the steps for changing the IDs for /dev/hdf2 and /dev/hdg1 are very similar.


Preparing the RAID Set

Now that the partitions have been prepared, we have to merge them into a new RAID partition that we'll then have to format and mount. Here's how it's done.
Create the RAID Set

You use the mdadm command with the --create option to create the RAID set. In this example we use the --level option to specify RAID 5, and the --raid-devices option to define the number of partitions to use.

[root@bigboy tmp]# mdadm --create --verbose /dev/md0 --level=5 \
--raid-devices=3 /dev/hde1 /dev/hdf2 /dev/hdg1

mdadm: layout defaults to left-symmetric
mdadm: chunk size defaults to 64K
mdadm: /dev/hde1 appears to contain an ext2fs file system
size=48160K mtime=Sat Jan 27 23:11:39 2007
mdadm: /dev/hdf2 appears to contain an ext2fs file system
size=48160K mtime=Sat Jan 27 23:11:39 2007
mdadm: /dev/hdg1 appears to contain an ext2fs file system
size=48160K mtime=Sat Jan 27 23:11:39 2007
mdadm: size set to 48064K
Continue creating array? y
mdadm: array /dev/md0 started.
[root@bigboy tmp]#

Confirm RAID Is Correctly Inititalized

The /proc/mdstat file provides the current status of all RAID devices. Confirm that the initialization is finished by inspecting the file and making sure that there are no initialization related messages. If there are, then wait until there are none.

[root@bigboy tmp]# cat /proc/mdstat
Personalities : [raid5]
read_ahead 1024 sectors
md0 : active raid5 hdg1[2] hde1[1] hdf2[0]
4120448 blocks level 5, 32k chunk, algorithm 3 [3/3] [UUU]

unused devices:
[root@bigboy tmp]#

Notice that the new RAID device is called /dev/md0. This information will be required for the next step.
Format The New RAID Set

Your new RAID partition now has to be formatted. The mkfs.ext3 command is used to do this.

[root@bigboy tmp]# mkfs.ext3 /dev/md0
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
36144 inodes, 144192 blocks
7209 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=67371008
18 block groups
8192 blocks per group, 8192 fragments per group
2008 inodes per group
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729

Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 33 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@bigboy tmp]#

Create the mdadm.conf Configuration File

Your system doesn't automatically remember all the component partitions of your RAID set. This information has to be kept in the mdadm.conf file. The formatting can be tricky, but fortunately the output of the mdadm --detail --scan --verbose command provides you with it. Here we see the output sent to the screen.

[root@bigboy tmp]# mdadm --detail --scan --verbose
ARRAY /dev/md0 level=raid5 num-devices=4
UUID=77b695c4:32e5dd46:63dd7d16:17696e09
devices=/dev/hde1,/dev/hdf2,/dev/hdg1
[root@bigboy tmp]#


Here we export the screen output to create the configuration file.

[root@bigboy tmp]# mdadm --detail --scan --verbose > /etc/mdadm.conf


Create A Mount Point For The RAID Set

The next step is to create a mount point for /dev/md0. In this case we'll create one called /mnt/raid

[root@bigboy mnt]# mkdir /mnt/raid

Edit The /etc/fstab File

The /etc/fstab file lists all the partitions that need to mount when the system boots. Add an Entry for the RAID set, the /dev/md0 device.

/dev/md0 /mnt/raid ext3 defaults 1 2

Do not use labels in the /etc/fstab file for RAID devices; just use the real device name, such as /dev/md0. In older Linux versions, the /etc/rc.d/rc.sysinit script would check the /etc/fstab file for device entries that matched RAID set names listed in the now unused /etc/raidtab configuration file. The script would not automatically start the RAID set driver for the RAID set if it didn't find a match. Device mounting would then occur later on in the boot process. Mounting a RAID device that doesn't have a loaded driver can corrupt your data and produce this error.

Starting up RAID devices: md0(skipped)
Checking filesystems
/raiddata: Superblock has a bad ext3 journal(inode8)
CLEARED.
***journal has been deleted - file system is now ext 2 only***

/raiddata: The filesystem size (according to the superblock) is 2688072 blocks.
The physical size of the device is 8960245 blocks.
Either the superblock or the partition table is likely to be corrupt!
/boot: clean, 41/26104 files, 12755/104391 blocks

/raiddata: UNEXPECTED INCONSISTENCY; Run fsck manually (ie without -a or -p options).

If you are not familiar with the /etc/fstab file use the man fstab command to get a comprehensive explanation of each data column it contains.

The /dev/hde1, /dev/hdf2, and /dev/hdg1 partitions were replaced by the combined /dev/md0 partition. You therefore don't want the old partitions to be mounted again. Make sure that all references to them in this file are commented with a # at the beginning of the line or deleted entirely.

#/dev/hde1 /data1 ext3 defaults 1 2
#/dev/hdf2 /data2 ext3 defaults 1 2
#/dev/hdg1 /data3 ext3 defaults 1 2

Mount The New RAID Set

Use the mount command to mount the RAID set. You have your choice of methods:

* The mount command's -a flag causes Linux to mount all the devices in the /etc/fstab file that have automounting enabled (default) and that are also not already mounted.

[root@bigboy tmp]# mount -a

* You can also mount the device manually.

[root@bigboy tmp]# mount /dev/md0 /mnt/raid


Check The Status Of The New RAID

The /proc/mdstat file provides the current status of all the devices.

[root@bigboy tmp]# raidstart /dev/md0
[root@bigboy tmp]# cat /proc/mdstat
Personalities : [raid5]
read_ahead 1024 sectors
md0 : active raid5 hdg1[2] hde1[1] hdf2[0]
4120448 blocks level 5, 32k chunk, algorithm 3 [3/3] [UUU]

unused devices:
[root@bigboy tmp]#

http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch26_:_Linux_Software_RAID#RAID_1
==========================================================================================================================
The first thing you need to know is that UNIX is based upon the idea of a stream. Everything is a stream, or appears to be. Device drivers look like streams, terminals look like streams, processes communicate via streams, etc... The input and output of a program are streams that you can redirect into a device, a file, or another program.
/dev/null - Wikipedia, the free encyclopedia

In Unix-like operating systems, /dev/null or the null device is a special file that discards all data written to it (but reports that the write operation ...
===============================================



Shutdow Linux on time:

# shutdown -r +5
# shutdown -r now
------------------------------------------------

Multiple IP on a single network.

Red Hat / RHEL / CentOS / Fedora Linux Instructions

Copy etc/sysconfig/network-scripts/ifcfg-eth0 file as /etc/sysconfig/network-scripts/ifcfg-eth0:0
# cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0:0
Open file /etc/sysconfig/network-scripts/ifcfg-eth0:0 using vi text editor:
# vi /etc/sysconfig/network-scripts/ifcfg-eth0:0
Find entry that read as follows:

DEVICE=eth0

Replace with:

DEVICE=eth0:0

Find entry that read as follows:

IPADDR=xxx.xxx.xxx.xxx

Replace it with your actual IP address:

IPADDR=192.168.1.7

At the end your file should like as follows:

DEVICE=eth0:0
IPADDR=192.168.1.7
NETMASK=255.255.255.0
NETWORK=192.168.1.0
ONBOOT=yes
NAME=eth0:0

Open file /etc/sysconfig/network-scripts/ifcfg-eth0 and make sure file does not have a GATEWAY= entry:
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
Find the entry that read as follows:

GATEWAY=your-ip

Remove or comment it out by prefixing # (hash) :

# GATEWAY=192.168.1.254

Save the file. Add the GATEWAY= to your /etc/sysconfig/network:

# vi /etc/sysconfig/network

Append or modify GATEWAY entry:

GATEWAY=192.168.1.254

Save the file. Reboot the system or run the following command:

# ifup eth0:0

OR

# service network restart
=======================================================


How to virtual webserver, Mail server, (apache.sendmail):

http://www.faqs.org/docs/Linux-mini/Virtual-Web.html
=============================================================



convert sound file:

After hours of searching I found a solution
$ mplayer thefiletobeconverted.rm -ao pcm
It gives a file called audiodump.wav
Then run:
$ lame -h -b 128 audiodump.wav myconvertedfile.mp3
__________________



convert sound file:

Gnormalize is a great tools for linux to convert sound file.

Installing atrps for the first time.(YUM)
http://atrpms.net/install.html

Download:
http://atrpms.net/dist/f7/gnormalize/

-----------------------------------------------------------
http://atrpms.net/install.html


How to wget+proxy:
In shell
#export http_proxy="192.168.0.1:3128"
-------------------------------------------------------
CISCO B#ngal113


-------------------------
How to install firefox in linux:
$ su
< password >
# mv firefox* /usr/local/bin/
# cd /usr/local/bin/
# tar -zxvf firefox*

Log out root with the keys: Ctrl+D
Type "kmenuedit"/"alacarte" or the "gnome-menu-editor" )

- Make a new menu entry, call it Firefox and fill in as command: /usr/local/bin/firefox/firefox

then save
-------------------------------
Linux -linux Multiboot:

http://www.justlinux.com/forum/showthread.php?threadid=143973

-------------

Difference x86 and sparc:

x86 typically means anything with the intel architecture like 386, 486, pentium, etc, so it also implies that you are running 32 bit, whether on linux or windows.

As far as the 64bit version goes, I'd avoid it unless you are doing lots of calculations or processing of some type. Even if your drivers are supported, a lot of codecs and other software won't work on 64 bit yet.

Eventually everything will work on the 64bit line, and everybody will move to it. It's not necessarily worth the trouble at this point, however.


x86 typically means anything with the intel architecture like 386, 486, pentium, etc, so it also implies that you are running 32 bit, whether on linux or windows.

As far as the 64bit version goes, I'd avoid it unless you are doing lots of calculations or processing of some type. Even if your drivers are supported, a lot of codecs and other software won't work on 64 bit yet.

Eventually everything will work on the 64bit line, and everybody will move to it. It's not necessarily worth the trouble at this point, however.

==
no, you'll see x86 and i386 / i586 / i686 etc... they are all the same as far as you're concerned, as they all specify Intel compatible architecture, i.e. Pentium 4 , Athlon, Duron etc... get i686 if you can as it will use more CPU features, but essentially they will all run fine
--
x86, the x means any one of 3,4,5,6,
all refer to intel/amd based system.
------------------
* i386 - If you have a Pentium or Celeron (meaning any Pentium or Celeron, including a Pentium 4, Pentium M, etc.) or the original Core Duo (not a Core 2 Duo).
* x86_64 - If you have a Core 2 Duo, Core Solo, Opteron, Athlon 64, Turion 64, or Sempron. (This also includes the new "Intel Mac" machines.)
* ppc - Any modern Mac that's not an Intel Mac.

--------------------------------
How To Stop AVG Scanner Hitting Apache Web Server:

Posted by Vivek Gite [Last updated: July 4, 2008]

If you noticed a lot of extra "MSIE 6.0" agents in Apache web server log, try following .htaccess code (hat tip to pixelbeat)

Rewritecond %{HTTP_USER_AGENT} ".*MSIE 6.0; Windows NT 5.1; SV1.$" [OR]
Rewritecond %{HTTP_USER_AGENT} ".*MSIE 6.0; Windows NT 5.1;1813.$"
RewriteCond %{HTTP_REFERER} ^$
RewriteCond %{HTTP:Accept-Encoding} ^$
RewriteRule ^.* http://www.avg.com/?LinkScannerSucks [R=307,L]
================================================================

Computer Related word:
http://www.geocities.com/ikind_babel/babel/babel.html

-----
HerbertSchieldt ar Teach yourself c/c++
(06:05:14 PM) tawhid_r: Schaum's series c/c++
(06:05:35 PM) tawhid_r: 2 books are renowned muc
======================================================
How to .chm to .html:
Download archmage tools
and run

#archmage xxx.chm destinetion_foldernale
## .chm viewer:
yum install kchmviewer
OR
yum install gnochm
========================================================
How to .chm tp .pdf
Download this script http://chm2pdf.googlecode.com/files/chm2pdf-0.9.1.tar.gz
or
http://www.karakas-online.de/downloads/chm2pdf-0.9.tar.gz
http://www.karakas-online.de/forum/viewtopic.php?t=10275

How to install:
Requires:

* chmlib
* pychm
* htmldo
then...
* Download the archive
* Unzip it (tar -xzvf chm2pdf-x.x.x.tar.gz)
* Enter the directory
* Become root
* Type "python setup.py install"
* Enjoy


HowToUse
Usage of chm2pdf

Usage:

/usr/bin/chm2pdf (--book / --webpage) [options] input_filename [output_filename]

Either '--book' or '--webpage' MUST be given! Only one of the two options can be present, not both!
=========================

How do I install yum-downloadonly plugin?

Type the following command to install plugin, enter:

# yum install yum-downloadonly


How do I download a RPM package only from RHN or CentOS mirror, without installing it?

Download httpd package but don't install/update, enter:
# yum update httpd -y --downloadonly
By default package will by downloaded and stored in /var/cache/yum/ directory. But, you can specifies an alternate directory to store packages such as /opt, enter:
# yum update httpd -y --downloadonly --downloaddir=/opt
===================================================================
How to install javaplugin in Linux:
Download the rpm.bin version of latest java
Install
make a link...with broswer.
[root@admin-4 /]# ln -s /usr/java/jre1.6.0_07/plugin/i386/ns7/libjavaplugin_oji.so /usr/lib/mozilla/plugins/
Restart your browser.
all are done.
--------------------------------------------
How to set date and time in linux:
[root@server /root]# date 092011082001
Thu Sep 20 11:08:00 CDT 2001
[root@server /root]# hwclock --utc --systohc
[root@server /root]# hwclock --show

-----------------------------------------------
How to edit video in linux
cinelerra: a linux video editor...........amazing.

http://cvs.cinelerra.org/getting_cinelerra.php#packages

doc:
http://www.linux.com/feature/60624

===============================================
How to install kdenlive:
yum install ffmpeg xine dvdauthor dvgrab kdebase
yum install ffmpeg ffmpeg-devel xine dvdauthor dvgrab qt-devel kdelibs-devel SDL SDL-devel SDL_image SDL_image-devel
libsamplerate libsamplerate-devel libogg libogg-devel libdv libdv-devel libvorbis libvorbis-devel
ladspa ladspa-devel libjack libjack-devel sox sox-devel libxml2 libxml2-devel libmad libmad-devel


* You'll have to download and compile mlt and mlt++

* mlt:
svn co https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt++ mlt+

configure:
Edit src/modules/sox/filter_sox.c, change #include to #include
Edit src/modules/avformat/Makefile and comment out the "LDFLAGS+=-lswscale$(AVFORMAT_SUFFIX)" line inside ifdef SWSCALE stanza
Edit src/modules/qimage/Makefile and add "CFLAGS+=-I/usr/include/kde" inside ifdef USE_KDE stanza
make/make install

* mlt++:
svn co https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt++ mlt++

didn't have any problems with standard configure/make/make install

* unsermake

svn co svn://anonsvn.kde.org/home/kde/tags/unmaintained/3/unsermake
export PATH=$PATH:path-to-unsermake-"binary"

Checkout Kdenlive from SVN:

svn co https://kdenlive.svn.sourceforge.net/svnroot/kdenlive/trunk/kdenlive kdenlive
cmake .
make
make install
------------------------
How to installing cmake:
wget -c http://www.cmake.org/files/v2.6/cmake-2.6.1-Linux-i386.sh

chmod +x cmake-2.6.1-Linux-i386.sh
su
./cmake-2.6.1-Linux-i386.sh
----------------------------------
How to print a man page to file:
command-
man ffmpeg | col -b >> man.txt
---------------------------------

Local port range sysctl tuning for high bandwidth Linux servers
September 23, 2007

Most of the Linux distributions specify local port range from 16384 to 65536 and this may be too low for very high bandwidth and busy boxes, let’s say SMTP, Hosting, POP3/Imap and Proxy servers.

You can adjust this setting by editing /etc/sysctl.conf file and replacing the default:

net.ipv4.ip_local_port_range = 16384 65536

with

net.ipv4.ip_local_port_range = 1024 65536

Filed under: Tips by Linux Admin

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

Red Hat Linux Static Routing Configuration
Posted by Vivek Gite [Last updated: August 17, 2008]

Q. I've two network interface connected to two different routers as follows:
[a] eth0 LAN network 10.0.0.0/8 - gateway IP - 10.8.2.65

[b] eth1 ISP assigned network 202.54.22.128/28 - gateway IP - 202.54.22.129

I can only ping to public server but not to another servers inside LAN? I'm not able to route traffic via 10.8.2.65. How do I configure static routing under Red Hat Enterprise Linux 5.x or CentOS Linux 5.2?

A. Under Red Hat you need to define static routing using route command. The configuration is stored under /etc/sysconfig/network-scripts/route-eth0 for eth0 interface.
Update route using route command

Type the following command:
# route add -net 10.0.0.0 netmask 255.0.0.0 gw 10.8.2.65 eth0
# route -n
Create static routing file

The drawback of abive 'route' command is that, when RHEL reboots it will forget static routes. So store them in configuration file:
echo '10.0.0.0/8 via 10.8.2.65' >> /etc/sysconfig/network-scripts/route-eth0
Restart networking:
# service network restart
Verify new changes:
# route -n
# ping 10.8.2.65
# ping 10.8.2.10
# ping google.com
# traceroute google.com
# traceroute 10.8.2.10
=================================

Configure BIND DNS Server to Listen Only On Certain IP Address or Network Interface

Here is sample configuration snapshot from named.conf file:

options
{
//listen-on-v6 { any; }; # For listen any interface
listen-on { 202.54.1.2; }; # Listen only specify IP
directory "/var/named"; // the default
dump-file "data/cache_dump.db";
statistics-file "data/named_stats.txt";
memstatistics-file "data/named_mem_stats.txt";
dnssec-enable yes;
recursion no;
allow-notify { 202.54.1.3; 202.54.1.4; };
version "go away";
};
===========================================================================
Bind Postfix Mail Server To Localhost or Specific IP Address Only
Posted by Vivek Gite [Last updated: June 10, 2008]

Q. How do I bind Postfix MTA to specific IP address such as 127.0.0.1 or 202.5.1.2?


Open /etc/postfix/main.cf file:
# vi /etc/postfix/main.cf
Append / modify line as follows to bind to localhost (127.0.0.1) only:
inet_interfaces = 127.0.0.1
If you need to bind to 127.0.0.1 and 202.5.1.2, enter:
inet_interfaces = 202.5.1.2,127.0.0.1
Save and close the file. You need to stop and start Postfix when this parameter changes. So type the following to restart Postfix:
# /etc/init.d/postfix restart
Verify that everything is working fine:
# netstat -tulpn | grep 25
# tail -f /var/log/maillog

==========================================================
echo Command in shell:


Use echo command to display text or value of variable.

echo [options] [string, variables...]
Displays text or variables value on screen.
Options
-n Do not output the trailing new line.
-e Enable interpretation of the following backslash escaped characters in the strings:
\a alert (bell)
\b backspace
\c suppress trailing new line
\n new line
\r carriage return
\t horizontal tab
\\ backslash

For e.g. $ echo -e "An apple a day keeps away \a\t\tdoctor\n"

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

Copy all file or dir except specific file:

#cp -r !(file1|file2|directory1|directory2) /dest

=======================================================
How to show the output of a shell script in PHP:

echo '
';
// Use 'system' to run the script.
$scriptOutput = system('/Destiny/www/html/current/testscripts.sh', $retval);
echo '
';
?>

==============================================================================
intitle:"index.of"(mp3|mp4|avi|mpeg) No.one.knows -html -htm -php -asp -jsp -cf
site:.edu intitle:"index.of" mp3 calculus
site:mit.edu filetype:pdf calculus

=========================================================================
How to set file/folder permission inheritancely and recursively:
chmod g+s /home/rahul/ -R

=========================================================-


b