content top
Showing posts with label Operating System. Show all posts
Showing posts with label Operating System. Show all posts

Monday, September 5, 2011

How to Crack Password Protected ZIP Files

People using Zip to compress their files beside compression they are trying to lock their important data with password(s).
Now let suppose if you do this same thing with your important files and now you have forgotten password, now what to do now its time to crack it.
This article will teach you how to crack the password of Zip files.


For this purpose we will use Linux based operating system and a tool FCrackZip for this purpose, FCrackZip is a fast and free-ware tool and it is easy to use Zip cracker tool it is similar to fzc and zipcrack. It has been written in assembler and it uses brute force and dictionary based attack to crack or find-out the passwords.
By using a simple Linux terminal and command you can easily crack the Zip password, you can download FCrackZip from your software manager.

Use this command to get FCrackZip from terminal
$ sudo apt-get install fcrackzip

After installing this you have options to attack on your zip file, either choose brute force attack or dictionary attack.
Here is the simple usage example.
$ fcrackzip -v -b -p aaaaaa -u your_zip_file.zip





By looking the above picture you can easily see the brute force attack against a zip file that is password protected, it took around 30 minutes to find the password for this zip.

Hack any Password Protected WI-FI Network & Use Unlimited Internet

Today I’ll tell you how do you hack any password protected wi-fi network with “CommView For Wi-Fi” software.

First you have to know what is Wi-Fi and how dose it work?
"Wi-Fi" is a type of wireless networking protocol that allows devices to communicate without cords or cables.
1: Wi-fi uses antennas around which wi-fi "hotspots" are created. The hotspots are outlets equipped to receive the radiowaves that power wireless networking. Until recently, wi-fi has been confined to more than 10,000 hot-spots in cafes, bars and airport lounges. But various projects are under way to set up city-wide zones, where a series of antennas are installed in the streets, on lampposts or street signs. The hotspots around them together create a much wider area of coverage. Norwich has a mesh network which links each lamppost antenna to the next creating a seamless wi-fi hotspot around the centre of the city.
2: The source internet connection is provided by a PC or server to which the antennas are connected either wirelessly or via a cable.
3: Some mobile phones and personal digital assistants (PDA) now have wi-fi chips installed. With mobile phones, this means conventional networks can be bypassed and inexpensive long-distance calls made over the web (using Voice over Internet Protocol, VoIP).
4: Many laptops and handheld computers now come with built-in wi-fi connectivity; it is also possible to add wi-fi to your computer with a special card that plugs into a port on your laptop.

Some organizations provide it for free but maximums provide it for business purpose only. And you have to give a password to access this kind of network.


This software price is $1099. Don't worry, I'm giving you for FREE.
Download This Software from HERE.
Note: Please turn off your anti-virus program before you install this software, otherwise this software will not work properly. After completing installing process you can re-run your anti-virus program.

Now follow the Instructions bellow:

1. Install the software and drivers.
2. Click on ‘Rules’ tab and tick on ‘Enable advance rules’ option.
3. Type ‘a’ on Name box and Past this code on formula box “tods=1 and dmac=FF:FF:FF:FF:FF:FF” like picture bellow. Then click ‘add/edit’ button.
4. A window will appear like the picture bellow. Give a tick on ‘a’ .


5. Then go to ‘Settings’ and click ‘Option’

6. Go to ‘Memory Usage’ tab and set everything just like this picture & click ‘Ok’ (Restart may be required).


7. Check ‘D’ funnel and uncheck another two funnel from the right top of this window.


8. Click ‘Search’ button and find the network that you want to creak.


9. Then drag it on ‘Channel’ tab and click ‘Capture’ button.
10. Now which one is do not capturing anything give it to password protected network and connect it. When it will ask for password, give any as you wish.
11. It will show this massage “Connected with limited connectivity”.
(I have no Wi-Fi connections at this time. that is why, I can’t share some screenshots).
12. Click on main menu again and then click on ‘Packets’ Tab. If everything was all right, you will see some Couple of Packets.


13. Click right button on “ARP REQ” Packet and then > “Send Packet(s)” > Selected.


14. This menu will appear.
15. Now change all values just like this and click ‘Send’.
16. Go to ‘Rules’ Tab again and uncheck the Rules “a” .

17. Select first 20000 packets and save it. Make sure you are saving it as “dump cap” file in place of “ncf” file format. (I have no Wi-Fi connections this time, that is why I can’t share some screenshots).

18. Now download a zip folder named “Aircrack-NG” from HERE. And extract it.
19. Open ‘bin’ folder and run this file ‘aircrack-ng-GUI.exe’. Then go where you saved the packets, select all and click launch.
20. An ‘IV’ list will came. Select the network that you want to creak.
21. Click ‘Connect’. You will be connected with your desire network like a magic !
22. Enjoy the Unlimited Wi-Fi Internet.

Also you can do with this software :


You can find more tutorials on about this software on the help menu of this software.

If you have any suggestion or comment please feel free to post it on the box bellow !

How to Hack your School's Network

Because of the frequency this question has been asked on this blog, i have decided to create a document for this question. This tutorial is for those newbies out there, wanting to "hack" their school. I'm gonna start by saying, if your going to hack the school, theres a high probability your get caught, and don't do anything dumb like deleting the network. Its lame, and you will get flamed for doing it. This hack will allow you to take control of the PC's at school. Lets start:

How to take control of the PC's at school:

Here are the steps;
  1. Preparing The Virus
  2. Setting Up The Virus
  3. Controlling The PC

Obviously, if you gonna take control over your school PC you need a virus. You have 2 methods:
  1. The virus I made which is harmless and you won't even notice it was executed.
  2. Dropping a Trojan on the school PC.
Method 1

What you need:
  • Pen Drive (You can buy one, or you just use yours)
  • Brain (You can't buy this)

Now, open notepad and copy/paste this code: the code

Save the file as something.bat (you can change something to whatever you want). In "Save as type:" choose "All Files".


I strongly recommend you not to change the rdport and tnport configuration. The rdport will open the remote desktop default port, and the tnport will open the telnet's client default port.

You can change the username, password and the rport (randomn port you choose to be opened)

At ipconfig /all >> C:\attach.txt you must change C:/ by your pen drive letter.

Save it and remove your pen drive.

Take your pen drive to school and run the bat file. Don't forget the pc you runned it in cause you might need it.

When you get home go to your pc and try to telnet them or remote desktop the PC.

Method 2:

In this method we will use a Trojan to control the school PC.

Here is a tutorial about how to create a Trojan: ProRat Trojan

Now just create a server (there is an explanation in the tutorial above), bind it and put it into your pen drive. Make sure you leave your PC turned on.

Then go to your school and drop the trojan.

Other way to do this is to give your trojan to a friend and tell him to stay in school. When you arrive home, send him a SMS and tell him to drop the trojan. This way you could even see if it worked.

After this you can probably do whatever you want with the PC.

Do you have questions, comments, or suggestions? Feel free to post a comment!

Sunday, September 4, 2011

Reset your Mobile Memory Card Password | Just 2 Minutes


We usually set password for our memory card for privacy and security, but the common mistake every one does at least once in out life time forgetting password. If you set password for mobile memory card, then you should be not forget the password. If you does then the only option is to formate your memory card with the help of the card reader and eventually the loss of all your data stored on it. There is a way to break the security wall. If you are a Symbian device lover then no need to worry about the password. You can crack them in few minutes.



In this tutorial I am going to teach you how to reset your memory card password in easy step. Before we start you need to have X-plore (application used to explore your system files and folder even the hidden folders in your device)



Step1: Install X-Plore in your mobile. If you want to download X-Plore search around internet you can download free trail.

Step2: Open your X-plore apps and Press 0(Zero) and check which you have marked the "show the system files"

Step3: Once you done that now go to the following path C:/Sys/Data/Mmcstore

Step4: Once you reached there you need to press "3" under option to set it in the Hex-viewer

Step5: See the third column you will able to see a line of code ! TMSD02G (c??"?x???6?2?6?2?6). Just check the character between the "?" it is your password ie: 62626



Note: If you have not set the password, then you will not able to gain access to C:/Sys/Data

Install Windows XP 5x Faster


Install Windows xp in less than 15 minutes
yes friends its true

this trick will be very helpful for those who frequently install windows xp operating system. Normally OS installation takes around 40 minutes to complete, but through this trick you can now save 10-15 minutes.
steps are :
1. Boot through Windows XP CD.

2. After all the files are completely loaded, you get the option to select the partition. Select “c”.
3. Now Format the partition, whether it is normal or quick with NTFS or FAT
4. Once the formatting is completed, All the setup files required for installation are copied. Restart your system by pressing Enter.

Now begins the Simple trick to save your time .
5. After rebooting, you get a screen where it takes 40
minutes to complete or finalize the OS installation.
6. Now, Press SHIFT + F10 Key -> This will open command prompt.
7. Enter “Taskmgr” at the command prompt window. This will open Task Manager.
8. Click the Process Tab, here we find a process called Setup.exe -> Right Click on Setup.exe -> Set Priority -> Select High or Above Normal. Initially it will be Normal.
thats it done!!!!

Cracking Windows Password


Here is the tutorial for cracking windows password:

How to hack a password on windows xp”
1) First go to start then (run).

2)Then type cmd in run and click entre, to open up a command prompt window.

3)Then type “net user” or “net users”
(it doesn’t matter which one you type but type with out double quotes)

4)It should now show all the user of the computer, choose the user tht u want to change the password for ,and..

5)Type
Net user “username” *
((fill in the user name tht you want to change but not the quotes, and yes you must put the star after the user name))

6)It should now move down a line and say (type a password for this user) .,so type the password tht u want ..it will not show wat you type for the password so make sure you type it correctly,once typed,hit enter,it will ask you to type again, so type the same password and hit entre. It will say..


**** THE COMMAND COMPLETED SUCCSESSFULLY***
enjoy

Linux Introduction

http://www.isc.tamu.edu/~lewing/linux/sit3-shine.7.gif
I. What is Linux?
II. Trying it out
III. Installing
IV. What to do now
V. The Console
Intro:

This tutorial is written with the total Linux n00b in mind. I've seen too many n00bs get totally left in the dark by asking what the best distro is. They seem to only get flooded with too many answers in so short a time. I'm a little bit of a n00b too, so I know how it feels. I will cover a grand total of two basic distros. You may learn to strongly prefer other ones (I do!) but this is just to get you started. I touch on a number of topics that would be impossible to go into in depth in one tutorial, so I encourage you to actively seek out more about the concepts I make reference to.
I. What is Linux?

Linux is basically an operating system (OS for short). The Windows machine you're (probably) using now uses the Mcft Windows operating system.
Ok, so what's so different about Linux?

Linux is part of a revolutionary movement called the open-source movement. The history and intricacies of that movement are well beyond the scope of this tutorial, but I'll try and explain it simply. Open source means that the developers release the source code for all their customers to view and alter to fit what they need the software to do, what they want the software to do, and what they feel software should do. Linux is a programmer?s dream come true, it has the best compilers, libraries, and tools in addition to its being open-source. A programmer's only limit then, is his knowledge, skill, time, and resolve.
What is a distro?

A distro is short for a distribution. It's someone's personal modification or recreation of Linux.
What do you mean by distros? I just want Linux!

Since Linux is open source, every developer can write his own version. Most of those developers release their modifications, or entire creations as free and open source. A few don't and try to profit from their product, which is a topic of moral debate in the Linux world. The actual Linux is just a kernel that serves as a node of communication between various points of the system (such as the CPU, the mouse, the hard drive etc.). In order to use this kernel, we must find a way to communicate with it. The way we communicate is with a shell. Shells will let us enter commands in ways that make sense to us, and send those commands to the kernel in ways that makes sense to it. The shell most Linux's use it the BASH shell (Bourne Again SHell). The kernel by itself will not do, and just a shell on top of the kernel won?t either for most users; we are then forced to use a distribution.
What distro is best?

This is not the question you want to ask a large number of people at one time. This is very much like asking what kind of shoe is best, you'll get answers anywhere from running shoes, hiking boots, cleats, to wingtips. You need to be specific about what you plan on using Linux for, what system you want to use it on, and many other things. I will cover two that are quick and easy to get running. They may not be the best, or the quickest, or the easiest, or the most powerful, but this is a guide for getting started, and everyone has to start somewhere.
How much does it cost?

computer + electricity + internet + CD burner and CDs = Linux I'll let you do your own math. Note however that a few do charge for their distros, but they aren't all that common, and can be worked around. Also, if you lack internet access or a CD burner or CDs or you just want to, you can normally order CDs of the distro for a few dollars apiece.
II. Trying it out.

Wouldn't it stink if you decide to wipe out your hard drive and install Linux as the sole operating system only to learn that you don't know how to do anything and hate it? Wouldn?t it be better to take a test drive? 95 out of a 100 of you know where I'm heading with this section and can therefore skip it. For those of you who don't know, read on.

There are many distros, and most distros try to have something that makes them stand out. Knoppix was the first live-CD distro. Although most of the other main distros have formed their own live-CDs, Knoppix is still the most famous and I will be covering how to acquire it.

A live-CD distro is a distribution of Linux in which the entire OS can be run off of the CD-ROM and your RAM. This means that no installation is required and the distro will not touch your hard disk or current OS (unless you tell it to). On bootup, the CD will automatically detect your hardware and launch you into Linux. To get back to Windows, just reboot and take the CD out.

Go to the Knoppix website (www.knoppix.com). Look around some to get more of an idea on what Knoppix is. When you're ready, click Download. You'll be presented with a large amount of mirrors, some of which have ftp and some of which have http also.

note: the speed of the mirrors vary greatly, and you may want to change mirrors should your download be significantly slow.

Choose a mirror. Read the agreement and choose accept. You'll probably want to download the newest version and in your native language (I'll assume English in this tutorial). So choose the newest file ending in -EN.iso

note: you might want to also verify the md5 checksums after the download, if you don't understand this, don't worry too much. You just might have to download it again should the file get corrupted (you'll have to anyway with the md5). Also, a lot of times a burn can be botched for who-knows what reason. If the disk doesn?t work at all, try a reburn.

Once the .iso file is done downloading, fire up your favorite CD-burning software. Find the option to burn a CD image (for Nero, this is under copy and backup) and burn it to a disk. Make sure you don't just copy the .iso, you have to burn the image, which will unpack all the files onto the CD.

Once the disk is done, put it in the CD-ROM drive and reboot the computer. While your computer is booting, enter CMOS (how to get to CMOS varies for each computer, some get to it by F1 or F2 or F3, etc.) Go to the bootup configuration and place CD-ROM above hard disk. Save changes and exit. Now, Knoppix will automatically start. You will be presented with a boot prompt. Here you can input specific boot parameters (called cheatcodes), or just wait and let it boot up using the default.

note: Sometimes USB keyboards do not work until the OS has somewhat booted up. Once you?re actually in Knoppix, your USB keyboard should work, but you may not be able to use cheatcodes. If you need to, attach a PS/2 keyboard temporarily. Also, if a particular aspect of hardware detection does not work, look for a cheatcode to disable it. Cheatcodes can be found on the Knoppix website in text format (or in HTML at www.knoppix.net/docs/index.php/CheatCodes).

Upon entering the KDE desktop environment, spend some time exploring around. Surf the web, get on IM, play some games, explore the filesystem, and whatever else seems interesting. When your done, open up the console (also called terminal, xterm, konsole, or even shell) and get ready for the real Linux. See section V for what to do from here.

note: to function as root (or the superuser) type su.

It's not entirely necessary that you are a console wizard at this point (although you will need to be sooner or later), but a little messing around wont hurt.

Just as there are many Linux distros, so there are also many types of Knoppix. I won?t go into using any of them, but they should all be somewhat similar. Some of them include: Gnoppix, Knoppix STD, Morphix, and PHLAK. Other distros also have live-CDs.
III. Installing

I will guide you through the installation of Fedora Core 2. The reason I chose Fedora is because it contains the Anaconda installer, which is a very easy installer.

Download the discs from here: http://download.fedora.redhat.com/pu...re/2/i386/iso/ If the link doesn?t work, then go to www.redhat.com and navigate your way to downloading Fedora (odds are your architecture is i386). You will want to download the FC2-i386-disc1.iso and burn it using the method for Knoppix. Do the same for all the discs.

Note: do NOT download the FC2-i386-SRPMS-disc1.iso files.

Now, once you?re ready, insert disc 1 into the drive and reboot.

The installer should come up automatically (if not, then see the Knoppix section on CMOS).

Note: installer may vary depending on version. Follow directions best you can using your best judgement.

1. Language: choose English and hit enter
2. Keyboard: choose us (probably) and hit enter
3. Installation media: choose local CDROM (probably) and hit enter
4. CD test: you can choose to test or skip
5. Intro: click next
6. Monitor: choose your monitor to the best of your ability, if you?re unsure, choose on of the generic ones
7. Installation type: choose which ever you want (default should be fine)
8. Partition: choose to automatically partition (unless you know what you?re doing)
9. Partition: the default partitions should suffice
10. Boot loader: choose your boot loader (grub for default)
11. Network settings: choose the correct settings for your network (generally, don?t mess with anything unless you know what you?re doing)
12. Firewall: you can choose a firewall if you want to
13. Language support: choose any additional language support you want
14. Time zone: pick your time zone
15. Root password: set your root password (root is the admin, or superuser; you want it to be very secure)
16. Packages: choose which packages you want to install. For hard drives over 10 gigs, you can go ahead and choose all
packages (depending on how much disk space you plan on taking up later, note that most everything you?ll need is a package: the exception being large media files). You will generally want to install all the packages you think you?ll ever need. Two desktop environments aren?t necessary. Make sure you have at least one and the X window system! (if you want a GUI that is). I suggest you get all the servers too.
Note: Knoppix uses the KDE Desktop environment
17. Make sure everything is all right, and install
18. You can create a boot disk if you want
Note: Desktop environments might have a set-up once you enter them
IV What to do now

Now that you have a Linux set-up and running, there are many paths you can head down. First, you should explore your GUI and menus. Browse the web with Mozilla, get on IM with GAIM, play games, add/delete users, check out OpenOffice, and anything else that might be part of your daily use. Also, set up a few servers on your computer to play around with, specifically SMTP (*wink*wink*), FTP (vsftp is a good one), and either telnet or SSH (OpenSSH is a good one). The setup and use of these are beyond the scope of this tutorial, but researching them could prove to be very educational.

The filesystem The Linux (and Unix) filesystem is different from the normal Windows that you?re used to. In Windows, your hard drive is denoted ?C:\? (or whatever). In Linux, it is called the root directory and is denoted ?/?. In the / directory, there are several default folders, including dev (device drivers) mnt (mount) bin (binaries) usr (Unix System Resources) home, etc, and others. I encourage you to explore around the whole file system (see section V) and research more.

Once you are well situated, it?s time to get into the heart and power of Linux: the console. The next session will guide you through it and set you on the path to finding out how to do stuff for yourself. You will (probably) want to start learning to rely less and less on the GUI and figure out how to do everything through the console (try launching all your programs from the console, for example).
V. The Console

The Console might look familiar to DOS if you?ve ever used it. The prompt should look something like the following:

AvatharTri@localhost avathartri$

With the blinking _ following it. This can vary greatly as it is fully customizable. Let?s get started with the commands.

First, let?s explore the file system. The command ls will "list" the files in the current directory. Here?s an example:

AvatharTri@localhost avathartri$ ls

It should then display the contents of the current directory if there are any. Almost all commands have options attached to them. For example, using the -l option, which is short for "long" will display more information about the files listed.

AvatharTri@localhost avathartri$ ls -l

We will get into how to find out the options for commands and what they do later.

The second command to learn will be the cd command, or "change directory". To use it, you type cd followed by a space and the directory name you wish to go into. In Linux, the top directory is / (as opposed to C:\ in Windows). Let?s get there by using this command:

AvatharTri@localhost avathartri$ cd /
AvatharTri@localhost /$

Now, we are in the top directory. Use the ls command you learned earlier to see everything that?s here. You should see several items, which are directories. Now, let?s go into the home directory:

AvatharTri@localhost /$ cd home
AvatharTri@localhost home$

And you can now ls and see what?s around. In Linux there are some special symbol shortcuts for specific folders. You can use these symbols with cd, ls, or several other commands. The symbol ~ stands for your home folder. One period . represents the directory your currently in. Two periods .. represent the directory immediately above your own. Here?s an example of the commands:

AvatharTri@localhost home$ cd ~
AvatharTri@localhost avathartri$

This moved us to our user?s personal directory.

AvatharTri@localhost avathartri$ cd ..
AvatharTri@localhost avathartri$ cd ..
AvatharTri@localhost home$

The cd .. moved us up to the home directory. As you?ve probably noticed by now, the section behind the prompt changes as you change folders, although it might not always be the case as it?s up to the personal configuration.

You can use these symbols with the ls command also to view what is in different folders:

AvatharTri@localhost home$ ls ~
AvatharTri@localhost home$ ls ..

And you can view what is in a folder by specifying its path:

AvatharTri@localhost home$ ls /
AvatharTri@localhost home$ ls /home

The last command we will cover as far as finding your way around the filesystem is the cat command. The cat command will show the contents of a file. Find a file by using the cd and ls commands and then view its contents with the cat command.

AvatharTri@localhost home$ cd [directory]
AvatharTri@localhost [directory]$ ls
AvatharTri@localhost [directory]$ cat [filename]

Where [directory] is the directory you want to view and [filename] is the name of the file you want to view. Omit the brackets. Now, if the file you viewed was a text file, you should see text, but if it wasn?t, you might just see jumbled garbage, but this is ok. If the file goes by too fast and goes off the screen, don?t worry, we will get to how to scroll through it later.

One of the most useful commands is the man command, which displays the "manual" for the command you want to know more about. To learn more about the ls command:

AvatharTri@localhost home$ man ls

And you will see the manual page for ls. It displays the syntax, a description, options, and other useful tidbits of information. Use the up and down arrows to scroll and press q to exit. You can view the manual pages for any command that has one (most commands do). Try this out with all the commands that you know so far:

AvatharTri@localhost home$ man cd
AvatharTri@localhost home$ man cat
AvatharTri@localhost home$ man man

One very crucial option to the man command is the -k option. This will search the descriptions of manual pages for the word you specify. You can use this to find out what command to do what you need to do. For example, let?s say we want to use a text editor:

AvatharTri@localhost home$ man -k editor

And you should see a list of apps with a short description and the word "editor" in the description.

With a blank prompt, you can hit tab twice for Linux to display all the possible commands. For Linux to display all the commands beginning with a certain letter or series of letters, type those letters and hit tab twice.

Note: This is actually a function of BASH and not Linux, but BASH is the default Linux shell.

Now that you know a little about moving around the filesystem and viewing manual pages, there is one more trick that we will cover to help you out. Remember how the man pages were scrollable as in you could use the arrow keys to scroll up and down? That is because the man pages use something called the less pager. We?re not going to go into what this does exactly and how it works, but that?s definitely something that you will want to look up. Here?s how to use the less pager with a file:

AvatharTri@localhost home$ cat [filename] | less

That uses something called a pipe. The line is the vertical line above enter on your keyboard. Briefly, what this does is take the output from the cat command, and stick it in the less pager. By doing this, you can view files that would normally run off the screen and scroll up and down.

Some final commands to check out:

mkdir - make directories
cp - copy file
mv - move file
rm - remove file
rmdir - remove directory
grep - search a file for a keyword
pwd - display current working directory
top - display system resources usage (kill the program with control + c)
HOW LINUX BOOT



As it turns out, there isn't much to the boot process:

1. A boot loader finds the kernel image on the disk, loads it into memory, and starts it.
2. The kernel initializes the devices and its drivers.
3. The kernel mounts the root filesystem.
4. The kernel starts a program called init.
5. init sets the rest of the processes in motion.
6. The last processes that init starts as part of the boot sequence allow you to log in.

Identifying each stage of the boot process is invaluable in fixing boot problems and understanding the system as a whole. To start, zero in on the boot loader, which is the initial screen or prompt you get after the computer does its power-on self-test, asking which operating system to run. After you make a choice, the boot loader runs the Linux kernel, handing control of the system to the kernel.

There is a detailed discussion of the kernel elsewhere in this book from which this article is excerpted. This article covers the kernel initialization stage, the stage when the kernel prints a bunch of messages about the hardware present on the system. The kernel starts init just after it displays a message proclaiming that the kernel has mounted the root filesystem:

VFS: Mounted root (ext2 filesystem) readonly.

Soon after, you will see a message about init starting, followed by system service startup messages, and finally you get a login prompt of some sort.

NOTE On Red Hat Linux, the init note is especially obvious, because it "welcomes" you to "Red Hat Linux." All messages thereafter show success or failure in brackets at the right-hand side of the screen.

Most of this chapter deals with init, because it is the part of the boot sequence where you have the most control. init

There is nothing special about init. It is a program just like any other on the Linux system, and you'll find it in /sbin along with other system binaries. The main purpose of init is to start and stop other programs in a particular sequence. All you have to know is how this sequence works.

There are a few different variations, but most Linux distributions use the System V style discussed here. Some distributions use a simpler version that resembles the BSD init, but you are unlikely to encounter this.
Runlevels

At any given time on a Linux system, a certain base set of processes is running. This state of the machine is called its runlevel, and it is denoted with a number from 0 through 6. The system spends most of its time in a single runlevel. However, when you shut the machine down, init switches to a different runlevel in order to terminate the system services in an orderly fashion and to tell the kernel to stop. Yet another runlevel is for single-user mode, discussed later.

The easiest way to get a handle on runlevels is to examine the init configuration file, /etc/inittab. Look for a line like the following:

id:5:initdefault:

This line means that the default runlevel on the system is 5. All lines in the inittab file take this form, with four fields separated by colons occurring in the following order:

# A unique identifier (a short string, such as id in the preceding example)
# The applicable runlevel number(s)
# The action that init should take (in the preceding example, the action is to set the default runlevel to 5)
# A command to execute (optional)

There is no command to execute in the preceding initdefault example because a command doesn't make sense in the context of setting the default runlevel. Look a little further down in inittab, until you see a line like this:

l5:5:wait:/etc/rc.d/rc 5

This line triggers most of the system configuration and services through the rc*.d and init.d directories. You can see that init is set to execute a command called /etc/rc.d/rc 5 when in runlevel 5. The wait action tells when and how init runs the command: run rc 5 once when entering runlevel 5, and then wait for this command to finish before doing anything else.

There are several different actions in addition to initdefault and wait, especially pertaining to power management, and the inittab(5) manual page tells you all about them. The ones that you're most likely to encounter are explained in the following sections.
respawn

The respawn action causes init to run the command that follows, and if the command finishes executing, to run it again. You're likely to see something similar to this line in your inittab file:

1:2345:respawn:/sbin/mingetty tty1

The getty programs provide login prompts. The preceding line is for the first virtual console (/dev/tty1), the one you see when you press ALT-F1 or CONTROL-ALT-F1. The respawn action brings the login prompt back after you log out.
ctrlaltdel

The ctrlaltdel action controls what the system does when you press CONTROL-ALT-DELETE on a virtual console. On most systems, this is some sort of reboot command using the shutdown command.
sysinit

The sysinit action is the very first thing that init should run when it starts up, before entering any runlevels.
How processes in runlevels start

You are now ready to learn how init starts the system services, just before it lets you log in. Recall this inittab line from earlier:

l5:5:wait:/etc/rc.d/rc 5

This small line triggers many other programs. rc stands for run commands, and you will hear people refer to the commands as scripts, programs, or services. So, where are these commands, anyway?

For runlevel 5, in this example, the commands are probably either in /etc/rc.d/rc5.d or /etc/rc5.d. Runlevel 1 uses rc1.d, runlevel 2 uses rc2.d, and so on. You might find the following items in the rc5.d directory:

S10sysklogd S20ppp S99gpm
S12kerneld S25netstd_nfs S99httpd
S15netstd_init S30netstd_misc S99rmnologin
S18netbase S45pcmcia S99sshd
S20acct S89atd
S20logoutd S89cron

The rc 5 command starts programs in this runlevel directory by running the following commands:

S10sysklogd start
S12kerneld start
S15netstd_init start
S18netbase start
...
S99sshd start

Notice the start argument in each command. The S in a command name means that the command should run in start mode, and the number (00 through 99) determines where in the sequence rc starts the command.

The rc*.d commands are usually shell scripts that start programs in /sbin or /usr/sbin. Normally, you can figure out what one of the commands actually does by looking at the script with less or another pager program.

You can start one of these services by hand. For example, if you want to start the httpd Web server program manually, run S99httpd start. Similarly, if you ever need to kill one of the services when the machine is on, you can run the command in the rc*.d directory with the stop argument (S99httpd stop, for instance).

Some rc*.d directories contain commands that start with K (for "kill," or stop mode). In this case, rc runs the command with the stop argument instead of start. You are most likely to encounter K commands in runlevels that shut the system down.

Adding and removing services

If you want to add, delete, or modify services in the rc*.d directories, you need to take a closer look at the files inside. A long listing reveals a structure like this:

lrwxrwxrwx . . . S10sysklogd -> ../init.d/sysklogd
lrwxrwxrwx . . . S12kerneld -> ../init.d/kerneld
lrwxrwxrwx . . . S15netstd_init -> ../init.d/netstd_init
lrwxrwxrwx . . . S18netbase -> ../init.d/netbase
...

The commands in an rc*.d directory are actually symbolic links to files in an init.d directory, usually in /etc or /etc/rc.d. Linux distributions contain these links so that they can use the same startup scripts for all runlevels. This convention is by no means a requirement, but it often makes organization a little easier.

To prevent one of the commands in the init.d directory from running in a particular runlevel, you might think of removing the symbolic link in the appropriate rc*.d directory. This does work, but if you make a mistake and ever need to put the link back in place, you might have trouble remembering the exact name of the link. Therefore, you shouldn't remove links in the rc*.d directories, but rather, add an underscore (_) to the beginning of the link name like this:

mv S99httpd _S99httpd

At boot time, rc ignores _S99httpd because it doesn't start with S or K. Furthermore, the original name is still obvious, and you have quick access to the command if you're in a pinch and need to start it by hand.

To add a service, you must create a script like the others in the init.d directory and then make a symbolic link in the correct rc*.d directory. The easiest way to write a script is to examine the scripts already in init.d, make a copy of one that you understand, and modify the copy.

When adding a service, make sure that you choose an appropriate place in the boot sequence to start the service. If the service starts too soon, it may not work, due to a dependency on some other service. For non-essential services, most systems administrators prefer numbers in the 90s, after most of the services that came with the system.

Linux distributions usually come with a command to enable and disable services in the rc*.d directories. For example, in Debian, the command is update-rc.d, and in Red Hat Linux, the command is chkconfig. Graphical user interfaces are also available. Using these programs helps keep the startup directories consistent and helps with upgrades.

HINT: One of the most common Linux installation problems is an improperly configured XFree86 server that flicks on and off, making the system unusable on console. To stop this behavior, boot into single-user mode and alter your runlevel or runlevel services. Look for something containing xdm, gdm, or kdm in your rc*.d directories, or your /etc/inittab.

Controlling init

Occasionally, you need to give init a little kick to tell it to switch runlevels, to re-read the inittab file, or just to shut down the system. Because init is always the first process on a system, its process ID is always 1.

You can control init with telinit. For example, if you want to switch to runlevel 3, use this command:
telinit 3

When switching runlevels, init tries to kill off any processes that aren't in the inittab file for the new runlevel. Therefore, you should be careful about changing runlevels.

When you need to add or remove respawning jobs or make any other change to the inittab file, you must tell init about the change and cause it to re-read the file. Some people use kill -HUP 1 to tell init to do this. This traditional method works on most versions of Unix, as long as you type it correctly. However, you can also run this telinit command:
telinit q

You can also use telinit s to switch to single-user mode.
Shutting down

init also controls how the system shuts down and reboots. The proper way to shut down a Linux machine is to use the shutdown command.

There are two basic ways to use shutdown. If you halt the system, it shuts the machine down and keeps it down. To make the machine halt immediately, use this command:
shutdown -h now

On most modern machines with reasonably recent versions of Linux, a halt cuts the power to the machine. You can also reboot the machine. For a reboot, use -r instead of -h.

The shutdown process takes several seconds. You should never reset or power off a machine during this stage.

In the preceding example, now is the time to shut down. This argument is mandatory, but there are many ways of specifying it. If you want the machine to go down sometime in the future, one way is to use +n, where n is the number of minutes shutdown should wait before doing its work. For other options, look at the shutdown(8) manual page.

To make the system reboot in 10 minutes, run this command:
shutdown -r +10

On Linux, shutdown notifies anyone logged on that the machine is going down, but it does little real work. If you specify a time other than now, shutdown creates a file called /etc/nologin. When this file is present, the system prohibits logins by anyone except the superuser.

When system shutdown time finally arrives, shutdown tells init to switch to runlevel 0 for a halt and runlevel 6 for a reboot. When init enters runlevel 0 or 6, all of the following takes place, which you can verify by looking at the scripts inside rc0.d and rc6.d:

1. init kills every process that it can (as it would when switching to any other runlevel).
# The initial rc0.d/rc6.d commands run, locking system files into place and making other preparations for shutdown.
# The next rc0.d/rc6.d commands unmount all filesystems other than the root.
# Further rc0.d/rc6.d commands remount the root filesystem read-only.
# Still more rc0.d/rc6.d commands write all buffered data out to the filesystem with the sync program.
# The final rc0.d/rc6.d commands tell the kernel to reboot or stop with the reboot, halt, or poweroff program.

The reboot and halt programs behave differently for each runlevel, potentially causing confusion. By default, these programs call shutdown with the -r or -h options, but if the system is already at the halt or reboot runlevel, the programs tell the kernel to shut itself off immediately. If you really want to shut your machine down in a hurry (disregarding any possible damage from a disorderly shutdown), use the -f option.


Thanks!!!

content top