Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

Thursday, September 27, 2012

Password Cracking




All of you would probably must have come across the term 'password'. Ever wondered why

exactly passwords work and how to crack them? Well, this manual will answer all your queries

about passwords and make you an expert in cracking passwords.


Passwords: An Introduction


First of all, what exactly is a password.A password is best described as a verification or an

authentication tool or object. Passwords are used to ensure legal and proper access to only those

people who have the authority or the permission to view the data.A password is required in many

places,you are required a password, to access your Inbox, you are required a password to dial up

to your Internet Service Provider and in some organisations you also need to enter a password to

start the system.At all places the Username and Password pair is used to authenticate the user.

Usernames are used to identify the user and the password is used to authenticate the user and

for every unique username there is a unique password.Take the example of the Lock and Key, for

every lock you need a unique key to open it and enter.Here the Lock acts as the Username and

the password would be the key.So passwords are as important as the key of your house.



Your house remains safe as long as only you who is the rightful owner has the key and no one

else finds it.Similiarly, the concept behind passwords is that it is only the rightful owner who

knows the password and no one else knows it.Everyday we hear about password stealing,

computer break ins etc.Sometimes the user chooses very lame passwords which are easily

guessed by hackers.There are certain guidelines which I would like to tell you which you must

keep in mind while choosing a password:



1. Never keep your password same as your Username

2. Never choose your own name, Date of Birth, spouse's name, pet's name, child's name etc as

your password, those are the first ones which are tried by a hacker.

3. Some people are so lazy that they keep their password to be 'Enter' (Carriage return)

4. Try to choose a word which is not in the dictionary and contains both numbers and alphabets,

and if possible use both Lower Case and Upper Case alphabets and also symbols like

(#,$,%,^ etc) as they can be cracked only be brute force password crackers which take too

long a time to crack.



You may say that choosing of weak passwords is responsible for the large number of hacks, but

people themselves are the weakest chain in the whole authentication process.Most people

usually use lame passwords like those I mentioned above, and those who use excellent

passwords are not able to remember them and then write the password down on a piece of paper

and stick it on their monitor.One should try his level best to remember weird passwords if he

wants to keep his system secure.The best places where you can find the passwords, would be

beneath the keyboard, behind the CPU or even on the sides of the monitor.

Some people have trouble remembering the large number of passwords that they are asked for,

while using various services, as a result they use the same password everywhere.Thus knowing

even a single password might help in some cases.



Password Cracking




The most common method of password cracking is password guessing, although it requires a lot

of luck, it can be successful sometimes.To start to guess the password, you first need to gather

all kinds of info about the victim.(See the Guidelines of keeping a password for more details.)

The most common and the most successful method of password cracking is th use of password

crackers.Now what exactly are password crackers? Now to understand what a password cracker

is and how it works, you first need to understand how a person is authenticated.

When you are creating a new account or registering or running the setup(basically whenever you

create a new account by entering the Username and Password.) you might be asked for the

Username and Password.The username is mostly stored in plaintext, but the password that you

enter is stored in an encrypted form.Now when you enter the password, it is passed through a pre

defined algoritm and is thus encrypted and is stored on the hard disk.So next time when you use

the account and enter the password, the text (password) you type is passed through the same

algorithm and is compared with the earlier stored value.If they both match, the user is

authenticated else the authentication fails.

The algorithm that is used to encrypt the password is a one way algorithm, by that I mean that if

we pass the encrypted password through the reverse algorithm, we will not get the original

plaintext password.

Lets take an example to make it more clear: Say your plaintext password is xyz123 and it is

passed through an algorithm and stored in the a file as 0101027AF. Now if you get his encrypted

password and know the algorithm which xyz123 is passed through to get 0101027AF, you cannot

reverse the algorithm to get xyz123 from 0101027AF.

When you are typing in your password, the computer does not display it in plaintext but instead

shows only stars i.e. ******** so that if someone is shoulder surfing, he cannot find out the

password.The text box has been programmed in such a way.On most forms Unix you will not

even see the asterix marks and the cursor will not move, so that neither does a person shoulder

surfing, find out the password nor does he find out the length of the password.



Password Crackers are of two types-: Brute Force and Dictionary Based.

Dictionary Based password Crackers try out all passwords from a given pre defined dictionary list

to crack a password.These are faster but more often than not are unsuccessful and do not return

the password.As they do not try out all combinations of possible keys, they are unable to crack

those passwords which have symbols or numbers in between.

Brute Force Password Crackers try out all combinations of all keys which can be found in the

keyboard (i.e. Symbols, Numbers, Alphabets) both Lower Case and Upper Case.These kinds of

Password Crackers have a greater success rate but take a long time to crack the password.As

they take all possible keys into consideration, they are more effective.

Now that you know the two main types of password crackers lets see how they work.

As passwords are encrypted by a one way algorithm, password crackers do not extract the

password from the file but instead take the combination of letters, encrypt them by passing the

characters through the original algorithm and compare this value with the stored encrypted

value.If these two match, then the password cracker displays the password in plaintext.



Cracking The Windows Login Password



The Windows ( 9x) password is passed through a very weak algorithm and is quite easy to crack.

Windows stores this login password in *.pwl files in the c:\windows directory.The .pwl files have

the filename which is the username coresponding to the password stored by it.A typical .pwl file

would be as follows:

Note: This .pwl file has been taken from a Win98 machine running IE 5.0



###############CUT HERE##############



ã‚…–                                                                                                                                                                                                                                                                  

ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ

ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ

ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿR

                                                                   

p u.ÐX+|rÐq”±/2³ Êå¡hCJ‚D  ×  `ÍY¥!íx}(qW¤ãƱ<!?àÜ6šá˜ôæ

4+\¾õ+%E°ËÔýmÇÔ ÞI»‚ B àלøÐ…'@



############CUT HERE#############



Lets go through the contents of this .pwl file.I am not sure what the first line signifies, but my

guess would be that it is the Name to which the computer is registered to.The next four lines have

just been entered by Windows and are not readable.The last two lines is the password but in the

encrypted form.There is no way to get the plaintext password by just studying the Windows

algorithm and these lines.To actually crack the password you need a simple but kewl cracker

coded in C called Glide.I have included the code below.If you have a sound C knowledge you can

study the code and actually experience how a password cracker works and how a password is

encrypted in Windows i.e. more about the Windows encryption algorithm.



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

Newbie Tip: All exploits, crackers, mail bombers practically everything related with Hacking has

been written in either Perl or C. If you really want to be considered an elitte hacker, you have to

know how to program, without a sound knowledge of either C (C++) or Perl you cannot hack

successfully.Almost all exploits available on the net have an important part edited or missing,

without which it has no use.Some exploits may be needed to be edited in order to be run in your

platform.In order to do all this programming is needed.

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





#include

#include

#include

#include

#include

#include



unsigned char huge Data[100001];

unsigned char keystream[1001];

int Rpoint[300];



void main (int argc,char *argv[]) {

FILE *fd;

int i,j,k;

int size;

char ch;

char *name;

int cracked;

int sizemask;

int maxr;

int rsz;

int pos;

int Rall[300]; /* recource allocation table */





if (argc<2 data-blogger-escaped-p="p">
printf("usage: glide filename (username)");

exit(1);

}



/* read PWL file */



fd=fopen(argv[1],"rb");

if(fd==NULL) {

printf("can't open file %s",argv[1]);

exit(1);

}

size=0;

while(!feof(fd)) {

Data[size++]=fgetc(fd);

}

size--;

fclose(fd);



/* find username */

name=argv[1];

if(argc>2) name=argv[2];

printf("Username: %s\n",name);



/* copy encrypted text into keystream */

cracked=size-0x0208;

if(cracked<0 data-blogger-escaped-cracked="0;</p">
if(cracked>1000) cracked=1000;

memcpy(keystream,Data+0x208,cracked );



/* generate 20 bytes of keystream */

for(i=0;i<20 data-blogger-escaped-i="i" data-blogger-escaped-p="p">
ch=toupper(name[i]);

if(ch==0) break;

if(ch=='.') break;

keystream[i]^=ch;

};

cracked=20;





/* find allocated recources */



sizemask=keystream[0]+(keystream[1]<<8 data-blogger-escaped-p="p">
printf("Sizemask: %04X\n",sizemask);



for(i=0;i<256 data-blogger-escaped-i="i" data-blogger-escaped-p="p" data-blogger-escaped-rall="rall">


maxr=0;

for(i=0x108;i<0x208 data-blogger-escaped-i="i" data-blogger-escaped-p="p">
if(Data[i]!=0xff) {

Rall[Data[i]]++;

if (Data[i]>maxr) maxr=Data[i];

}

}

maxr=(((maxr/16)+1)*16); /* recource pointer table size appears to be divisable by

16 */



/* search after recources */



Rpoint[0]=0x0208+2*maxr+20+2; /* first recource */

for(i=0;i
/* find size of current recource */

pos=Rpoint[i];

rsz=Data[pos]+(Data[pos+1]<<8 data-blogger-escaped-p="p">
rsz^=sizemask;

printf("Analyzing block with size: %04x\t(%d:%d)\n",rsz,i,Rall[i]);

if( (Rall[i]==0) && (rsz!=0) ) {

printf("unused resource has nonzero size !!!\n");

printf("If last line produced any : You may try to recover\n");

printf("press y to attempt recovery\n");

ch=getch();

if(ch!='y') exit(0);

rsz=2;

i-=1;

}



pos+=rsz;



/* Resources have a tendency to have the wrong size for some reason */

/* check for correct size */



if(i
while(Data[pos+3]!=keystream[1]) {

printf(":",Data[pos+3]);

pos+=2; /* very rude may fail */

}

}



pos+=2; /* include pointer in size */

Rpoint[i+1]=pos;

}

Rpoint[maxr]=size;



/* insert Table data into keystream */

for(i=0;i <= maxr;i++) {

keystream[20+2*i]^=Rpoint[i] & 0x00ff;

keystream[21+2*i]^=(Rpoint[i] >> 8) & 0x00ff;

}

cracked+=maxr*2+2;



printf("%d bytes of keystream recovered\n",cracked);



/* decrypt resources */

for(i=0;i < maxr;i++) {

rsz=Rpoint[i+1]-Rpoint[i];

if (rsz>cracked) rsz=cracked;

printf("Recource[%d] (%d)\n",i,rsz);

for(j=0;j
printf("\n");

}





exit(0);

}





Windows Screen Saver Password



This is an interesting hack and not many people know about it.This requires no canned hacking

tool, we will crack the password manually!!! First of all, why do we need to crack the Windows

Screen Saver? How does it restrict us? If a Screen Saver is password protected, then whenever it

is turned on, then in order to turn it off, you need to enter a password.It does not allow us to do

anything on a system until and unless we enter the password. We will keep seeing the screen

saver until we authenticate ourselves by entering the password.No not even CTRL+ALT+DEL

works in this case. Windows stores the Screen Saver password in the user.dat file in the

Windows directory.If you have multiple profiles on your system then it is stored in the user.dat file

in the c:\windows\profiles\username directory.(On Win 3x systems it is stored in the control.ini file

The user.dat file constitues the registry of the Windows system, thus we can say that the

Windows Screen Saver Password is stored in the registry.

First of all, you need to change the attributes of this file and make it editable by right clicking on it

and unselecting the Read Only Option else you will not be able to edit it.

Once this is done, open this file in WordPad (Any text editor will do except MS WORD And

Notepad.)Now look for the string: ScreenSave_Data

You will find an even number of characters after Data, this is the Screen Saver Password

encrypted and stored in the hex system.Each pair or hex values represent a single ASCII

plaintext character.This means that if there are 10 hex values then the password is of 5

characters, each pair of Hex values standing for a single plaintext ASCII character.So in order to

get the Plaintext password you just need to decrypt these hex values into ASCII.




Internet Dial Up Password




Have you ever wondered where Windows stores the Internet Connection Password when you

have enabled the 'Save Password' option in the 'Connect To' dialog box of the dial up connection.

Well this password is stored in the registry in the following registry key:



HKEY_CURRENT_USER\RemoteAccess\Profile\



If you view the above key in the registry Editor then it probably will not appear understandable. If

you want to be able to understand the contents of this key and hence be able to edit this key,then

you will have to export this particular key and view it in Notepad.The password is stored in stored

as binary values and has to be converted into plantext ASCII before you are able to read it.



Windows NT Password



You have already seen how lame Windows 9x password encrypting algorithm is and how easy it

is to overide the Windows Login Password prompt in Win9x systems, well NT is a different

story.First of all lets see how the password is stored in NT….firstly the password is not encrypted,

it is hashed using the RSA hash function and then this hashed version is passed through am

algorithm to obscure it, once onscured,it is stored in the NT registry.Alongwith a stonger

password storing tecnique it all ships with various utilities which make it more secure….Service

Pack 2 ships with a dll which allows the system adminstrators to ensure that the Passwords used

by the users are strong or good enough.The User Manager can be configured to ensure that the

user passwords satisfy a particular condition, For example, it can check if the Users are using a

password of minimum length.

If you really want to learn all about NT security, you should read the NTBugtraq archives and join

their mailing list.The NTBugtraq Archive is the most comprehensive and exaustive collection of

NT Security info.Visit them at www.ntbugtraq.com

The site has everything that you would want to know about NT including the algorithm used to

obscure the hased password.There are various ways of getting administrator previledges in NT, I

am not mentioning all of them but have mentioned my favourite….Sam Attacks.If you want to

learn about all the ways of breaking into NT, then I recommend you to read the BugTraq

Arvhives.I would also be writing a Manual on Hacking NT quite Soon.

__________________________

Sam Attacks



Recently, the algorithm for reversing the obfuscation (obscuring) step of hashing an NT user ID's

password was published. This has resulted in a great deal of discussion over the relative security

of Windows NT systems. This article intends on providing you, the NT Administrator, with

sufficient information and understanding to ensure you are able to DETECT an attempt to exploit

your systems using this algorithm.



Q: What's this all about?



A: When a password is stored on Windows NT, it is stored in hashed [not encrypted] form. The

clear-text password is first hashed using the RSA MD4 hash function, it is then obscured again

using an algorithm (which has now been published). Once obscured, it is stored within the NT

registry. The hashed MD4 version of the password (generally accepted as not reversible to clear-

text) can be used to create a valid challenge response for its user ID. Therefore, should access to

this value be obtained, it would be possible to connect to an NT resource authenticating as that

user ID despite not having the clear-text password for that user. Since the method of removing

the obfuscation step has now been published, and since its possible to view the keys which store

the hashed passwords, its possible that this could be done.



Q: But someone must compromise the Administrator accout first, right?



A: Yes, but...as Les Landau quickly pointed out, the entire Security Access Manager (SAM)

database is backed up whenever the Emergency Repair Disk (ERD) is updated. Since updating

the ERD is good practice, its likely that your SAM has been backed up. By default, the backed up

SAM is stored in the file %systemroot%\repair\sam._ , and this directory, by default, allows the

group EVERYONE read access. It would be possible to retrieve the hashed passwords from this

file rather than from the live registry. The live registry requires Administrator, Administrator Group,

or Backup Operator priviledge in order to access the password keys. The backed up SAM in the

\repair directory does not. It is considered good practice to not give unrestricted access to the root

directory of your %systemroot% drive, as a precaution against having your system files

manipulated. By default these directories are not available over the network by anyone other than

the Administrator, members of the Administrators group, or the Backup Operator, so this only

becomes a risk if you allow other users access either by allowing them to log on at the machine

itself (log on locally) or by you creating a share at the root of your system drive granting others

permission. Neither of these scenarios are recommended in the interest of security. See

Recommendation #1 below for details on how to secure this file.



Q: Ok, so once I've protected the SAM._ file, then the only other way my machine can be

exploited is by fooling the Administrator, right?



A: The Administrator, members of the Administrators Group, the Backup Operator, and anyone

who has been granted the privilege to backup and restore files, all have the ability to access this

information. Furthermore, anyone who can start the Scheduler Service also has the ability to view

these entries (this will be explained in detail below). It should be noted, however, that nobody

other than the Administrator or members of the Administrators group has the ability to submit a

Schedule job. While it is possible for an Administrator to grant this ability to the Server Operators

group, this is strongly discouraged. Finally, despite the amount of discussion that has been held

on the topic, there is still a community of people who do not appreciate the threat of the Trojan

program. Fooling the Administrator is becoming easier as the web interface technology evolves.

Double-clicking may not be necessary to execute an application, and its possible for some

applications to launch themselves if reckless acceptance of Authenticode certificates has taken

place. Administrators may be logging into user's workstations, and if that workstation has not had

security controls in place, it's possible that the owner has put programs in the "All Users" Startup

group, thereby making them execute as the Administrator when he/she logs on to the

workstation.



As Microsoft have already said, it cannot be emphasized enough that the use of the Administrator

user ID should be strictly controlled and minimized in every way possible. So to the Backup

Operator account. Users who have been made members of the Administrators group should

similarily be tightly controlled. The most common reason for these types of permissions is a lack

of effort to properly configure user IDs which can access the necessary resources as something

other than members of the Administrators group. As these accounts have virtually limitless

abilties (since that is their purpose and design), their use must be controlled.



Q: Ok, but what if I want to have users of the Administrators group be able to use those

accounts for their everyday work?



A: Obviously this is a common situation in NT environments today. You should change it. If you

are willing to accept the risks that are associated with having such powerful accounts using

untrusted programs, you can rely on auditing to alert you to attempts to exploit your systems.

Unfortunately, due to your acceptance of the risks, you may not be able to prevent the exploits,

but you will be able to find out that they have taken place. Auditing, by default, is not turned on in

Windows NT. In order to record security events as they occur, you have to enable it. Below you

will find detailed instructions on how to establish security auditing, and in particular, how to audit

access to the sensitive areas containing the passwords. However, just auditing is not enough.

Once enabled, you also have to review the event logs regularily and be able to understand what

those events mean. In addition, it should be understood that audit events are recorded on the

machine at which they occur, they are not distributed throughout a domain. So if you have a

Backup Domain Controller in Toronto, and your Primary Domain Controller is in Lindsay, you will

need to collect the event logs from both locations and review them to determine if your passwords

have been violated. Either of these machines could be attacked and pose an equal risk, but only

the machine which is attacked will record the security audit event. There are a variety of

programs available for NT which can do event monitoring, collection, and alert notification. If you

are seriously interested in such a tool, contact me privately and I'll give you a list of currently

available products. Unfortunately none of them are inexpensive, but their costs pale in

comparison to the cost of trying to do this event work in a large scale environment manually.





RECOMMENDATION #1 - How to secure the %systemroot%\repair\sam._ file



By default, the SAM._ file and \repair directory has the following permissions;



Administrators: Full Control

Everyone: Read

SYSTEM: Full Control

Power Users: Change

1. From within Explorer, highlight the SAM._ file, right click, choose properties, security,

permissions. Remove all privilege from this file.





2. From a DOS prompt, execute the following;



cacls %systemroot%\repair\sam._ /D Everyone



This will deny the group Everyone permission to the file, ensuring that no other

permission (i.e. inheritted permissions from a share) can override the file permission.





3. Whenever you need to update your ERD, first execute the following from a DOS prompt;



cacls %systemroot%\repair\sam._ /T /G Administrators:C



This will grant Administrators change permission to update it during the ERD update.





4. Once the ERD has been updated, execute the following from a DOS prompt;



cacls %systemroot%\repair\sam._ /E /R Administrators



This will once again remove the permissions for Administrator.





RECOMMENDATION #2 - How to enable auditing on password registry keys

1. First you have to make sure auditing is enabled. Start User Manager, Policies, Audit, and

click "Audit These Events".





2. By default, Windows NT does not identify any users or groups to audit on any objects

within the system. Auditing can add performance overhead to your system depending on

the available resources, so care should be taken in determining what and whom to audit.

For a full description of auditing in Windows NT, I recommend the Microsoft Press book

"Windows NT 3.5 - Guidelines for Security, Audit, and Control", ISBN 1-55615-814-9.

Despite its title it is still the most comprehensive coverage of auditing that I have read.

For the sake of this example, we will simply check every Success and Failure checkbox.





3. Close the dialog.





4. Now for a little known trick. While logged on as Administrator, ensure that the Schedule

service is set to start up as the System account. Once set, start the Schedule service.





5. Check the time, and then open a DOS prompt. At the DOS prompt, type in the following;

at 22:48 /interactive "regedt32.exe" where 22:48 gets replaced with the current time plus

1 minute (or 2 or whatever amount of time you think it will take you to type in the

command).





6. At the designated time, regedt32.exe will fire up and appear on your desktop. This

incarnation of regedt32.exe will be running in the security context of the user SYSTEM.

As such, you will be able to see the entire registry, every key within the SAM or Security

trees. BE VERY CAREFUL HERE. It is important to note that when running an applicatin

as SYSTEM, it does so attempting to use null session for credentials. Null session

support has been disabled by default in all versions of Windows NT after 3.1, therefore

any attempt to connect to non-local resources as this security context will fail. An

Administrator could enable null session support through the registry, but such a

configuration is strongly discouraged.





7. All we want to do is enable auditing on the designated keys, nothing else. To this end, we

highlight the HKEY_LOCAL_MACHINE windows within regedt32. Next highlight the SAM

tree. Choose the Security menu item, then Auditing.





8. Click on the Add button and choose Show Users.





9. I'm going to recommend that you add the SYSTEM user, the group Domain Admins, and

the user Administrator. You want to cover any account which has the right to;

"Take ownership of files or other objects"

"Back up files and directories"

"Manage auditing and security log"

"Restore files and directories"

"Add workstations to domain"

"Replace a process level token"





10. Click the Audit Permission on Existing Subkeys





11. Next, click in the Success and Failure checkboxes for the following entries;

- Query Value

- Set Value

- Write DAC

- Read Control





12. Choose OK, and then Yes.





13. Repeat the process for the Security tree.





14. Close REGEDT32, and stop the Schedule service. You will want to set the Schedule

service to use a userID for startup which you create, rather than SYSTEM, in future. Take

this opportunity to create such a user and change the startup for Schedule.



You will now have applied auditing to the entire SAM ensuring you'll be notified via the Event

Logger of any failed or successful access to your sensitive information by the only accounts

which have the ability to access such information. The issue of what to do when/if you discover

event notifications is beyond the scope of this document. Part of a good security policy is an

appropriate audit policy which would dictate how the event logs are reviewed, how the information

is verified, and what actions should be taken for each possible event. Refer to the book I've

recommended above for information on how to establish such a policy, or contact a consultant

capable of defining and implementing such a policy within your organization (not me, my plate's

full thanks).

______________________________________



L0phtCrack is a NT password cracker which can get NT passwords using both dictionary based

and brute force attacks.It can also be run on lower priority so that it can work in the background,

while NT is running.





Cracking Unix Password Files



Unix is considered to be the most secure OS.The method used to store passwords is definitely

more safe and secure in Unix systems.In most Unix systems you will find that the passwords are

stored in file called 'passwd' which is located at /etc/passwd.The password file has many lines of

the following basic structure:



ankit:RqX6dqOZsf4BI:2:3:Ankit Fadia:/home/ankit:/bin/bash



The above line can be broken and arraged as follows:



Username: ankit

Encrypted Password: RqX6dqOZsf4BI

User number: 2

Group Number: 3

Actual Name: Ankit Fadia

Home Directory: /home/ankit

Type of Shell: /bin/bash



As the encryption algorithm is one way you cannot decrypt the password but need to use a

password cracker which will crack the password for you.

The example line of the passwd file that I gave was a line taken from a unshadowed password

file.Now sometimes you may find that instead of the above line you may find something like the

below:



ankit:*:2:3:Ankit Fadia:/home/ankit:/bin/bash



The above line has been taken from a shadowed password file.In a shadowed password file what

happens is that the password field is replaced by a ' * ' (The ' * ' is called a token.)such that the

encrypted password does not show up in the password file and the list of encrypted passwords is

stored in a different file which is not readable by normal users.



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

Hacking Tip: The ' * ' that replaces the passwords in shadowed password files is called a token

and on some systems it is also ' $ ' or ' # ' or even same as the Username.

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

So first of all to start cracking the password file you need to unshadow the passwords.You can

unshadow the passwords by running the following C program that I picked up somewhere.



struct  SHADOWPW {     /* see getpwent(3) */                                  char *pw_name;

     char *pw_passwd;

int  pw_uid;                                                        



     int  pw_gid;

     int  pw_quota;



     char *pw_comment;                                                    



     char *pw_gecos;

     char *pw_dir;

char *pw_shell;                                                      

   };                                                                    

   struct passwd *getpwent(), *getpwuid(), *getpwnam();

   #ifdef   elxsis?



   /* Name of the shadow password file. Contains password and aging info *

                                                                         

   #define  SHADOWPW "/etc/shadowpw"                                      

   #define  SHADOWPW_PAG "/etc/shadowpw.pag"                              

   #define  SHADOWPW_DIR "/etc/shadowpw.dir"                              

   /*                                                                    

    *  Shadow password file pwd->pw_gecos field contains:                

    *                                                                    

    *  ,,,,                

    *                                                                    

    *    = Type of password criteria to enforce (type int).           

    *  BSD_CRIT (0), normal BSD.                                          

    *  STR_CRIT (1), strong passwords.                                    

    *    = Password aging period (type long).                       

    *  0, no aging.                                                      

    *  else, number of seconds in aging period.                          

    *   = Time (seconds from epoch) of the last password        

    *  change (type long).                                                

    *  0, never changed.n                                              

    *    = Time (seconds from epoch) that the current password    

    *  was made the (type long).                             

    *  0, never changed.ewromsinm                                        

    *   = Password (encrypted) saved for an aging t  

    *  prevent reuse during that period (type char [20]).                

    *  "*******", no .                                        

    */                                                                    

                                                                         

   /* number of tries to change an aged password */                      

                                                                         

   #define  CHANGE_TRIES 3                                                

                                                                         

   /* program to execute to change passwords */                          

                                                                         

   #define  PASSWD_PROG "/bin/passwd"                                    

                                                                         

   /* Name of the password aging exempt user names and max number of entir      

                                                                         

   #define  EXEMPTPW "/etc/exemptpw"                                      

   #define MAX_EXEMPT 100                                                

                                                                         

                                                                         

   /* Password criteria to enforce */                                    

                                                                         

   #define BSD_CRIT 0 /* Normal BSD password criteria */                  

   #define STR_CRIT 1  /* Strong password criteria */                    

   #define MAX_CRIT 1                                                    

   #endif   elxsi                                                        

   #define NULL 0                                                        

   main()                                                                

   {                                                                      

   struct passwd *p;                                                      

  int i;

   for (;1;) {;                                                          

    p=getpwent();

     if (p==NULL) return;

     printpw(p);                                                        

   }                                                                      

   }

                                                                                                                                           

   printpw(a)                                                            

   struct SHADOWPW *a;                                                    

   {  

                                                                 

   printf("%s:%s:%d:%d:%s:%s:%s\n",                                      

      a->pw_name,a->pw_passwd,a->pw_uid,a->pw_gid,                        

      a->pw_gecos,a->pw_dir,a->pw_shell);                                

   }                                                                      



Now once the password file has been unshadowed you can use either Jack The Ripper or

Cracker Jack to crack the passwords.Cracker Jack is a DOS based Unix password file cracker

which can perform only dictionary based cracking.Do make sure that the password file that you

are trying to crack is unshadowed as these crackers cannot crack shadowed password files.

You also need an exaustive Dictionary List  or a Wordlist.The more comprehensive the wordlist

the more is your chance to be able to crack the password file.You can get both these crackers

from a lot of places:



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

Hacking Tip: Want to find out where the password file is stred in your version of Unix?

Well to find out your Unix Version type the following command:

uname -a      



The following are the paths where Password files are stored in various Unix versions:                                                  

                                                                                     

        UNIX Paths (Courtesy of 2600)                                                

                                                                                     

        UNIX                  Path                                              Token                  

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

        AIX 3                 /etc/security/passwd                          !                      

               or             /tcb/auth/files/
                                of username>/                             

        A/UX 3.0s             /tcb/files/auth/?/*                                    

        BSD4.3-Reno           /etc/master.passwd                   *                      

        ConvexOS 10           /etc/shadpw                               *                      

        ConvexOS 11           /etc/shadow                               *                      

        DG/UX                 /etc/tcb/aa/user/                             *                      

        EP/IX                 /etc/shadow                                      x                      

        HP-UX                 /.secure/etc/passwd                        *                      

        IRIX 5                /etc/shadow                                      x                      

        Linux 1.1             /etc/shadow                                     *                      

        OSF/1                 /etc/passwd[.dir|.pag]                      *                      

        SCO Unix #.2.x        /tcb/auth/files/
                                     of username>/                            

        SunOS4.1+c2           /etc/security/passwd.adjunct    ##username              

        SunOS 5.0             /etc/shadow                                            

                             
        System V Release 4.0  /etc/shadow                          x                      

        System V Release 4.2  /etc/security/* database                                

        Ultrix 4              /etc/auth[.dir|.pag]                             *                      

        UNICOS                /etc/udb                                        *                      

                                                                                     

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



I have explained to you how to crack a Unix password file, but the most difficult part is getting the

Unix Password file.You first need to find a hole in the services running at various ports of the

host. There are many C program that you may find on the net which will promise to get you root

or to get you out of the restricted shell etc. But I assure you that almost all of these ready made C

programs have a tiny little part either missing or edited. A huge Sendmail Exploit that was

publised on the web had the most important line commented and hence the exploit did not work.

I again emphasize the need to learn to program.Programming is very very important not only in

debuging already found exploits but also to discover new holes in popular daemons.To find a hole

say in Sendmail you need to go through the it's code over and over again and look for that tiny bit

that is exploitable.So the bottomline is that one must know how to program to do anything in

Hacking.



HTTP Basic Authentication 


The most common methods of authentication used by web sites are either CGI Based or

JavaScript based.Another type of authentication which is slowly becoming popular is the HTTP

Basic authentication.

You must have almost certainly come across password protected websites which pop up a dialog

box with the title   $$$$$$$$$ and something like the following text:



UserName and Password Required

Enter Username and Password for server.name.here

Username:

Password:



The HTTP Basic Authentication works same on all servers and is now becoming commonly used

for protecting data from the general public.This kind of Authentication does not provide much of

security and can be easily exploited to return the password.But anyhow I will mention how to

setup a server so that it uses HTTP Basic Authentication.

Note: I am running Apache and the method to do the same on other platforms may vary.

Contact the company for more info on how to setup your server to use HTTP Authentication.

First of all create the password file by typing the htpasswd command:



$>htpasswd -c /etc/httpd/conf/passwords



Once the password file has been created we need to add the users to this password file.For that

use the following command:



$>htpasswd /etc/httpd/conf/passwords ankit.fadia



Then you will be prompted to enter the password for the user twice.Once you have completed

this process,the Username and Password will be stored in the /etc/httpd/conf/passwords file in

the following structure or format:



ankit.fadia:ryWT.SmffRa7pf



The first two fields are obviously the Username and the last two fields is the password encrypted

by the DES algorithm.This file is world readble, by that I mean to say that the file can be read by

anyone.So if possible disable the FTP and Telnet ports of the Server using HTTP Basic

Authentication.Although it will not make much of a difference as this kind of Authentication can

easily be hacked, but it always makes sense to be on the safer side and make work difficult for a

hacker.

Now that the password file is ready we need to configure the /etc/httpd/conf/srm.conf file to tell

the server where the password file is and what kind of banner should it show when the user

needs to be authenticated.

So edit the /etc/httpd/conf/srm.conf file and enter the following lines:





AuthType Basic

AuthName server.name.here

 AuthUserFile /etc/httpd/conf/passwords

require valid-user




The directory tag is which folder or directory requires a password.Thus when the user tries to

access the mentioned directory the HTTP Password prompt appears.The AuthType specifies the

type of authentication.The AuthName gives the name to the banner that is popped up by the

browser.the AuthUserFile specifies the path of the password file.The require tag can be

configured such even is a Username is part of the password file, he will not be authenticated

unless and until he is withing the require tag.For Example,



require ankit.fadia ankit



If the above line is there in the srm.conf file then no one other than ankit and ankit fadia will be

authenticated.



Cracking such HTTP Basic Authentication passwords differs from server to server.It also depends

on how the system administrator has configured this service.First of all, to find out if the server is

actually running HTTP Authentication service, you need to type in the wrong password and if you

get the 401 Error, then you can be pretty sure of it.To hack the HTTP passwords, you need to get

the sniffer logs, it would contain what a request would look like if we were able to request the

page.It would be something like the following:



GET /pagehere HTTP/1.1

Authorization: Basic rTyna2yrqw2ADGHsghis==



The text after Basic is the password.No…it is not encrypted, but is just  Base64 encoding.You

can easily decode it in Perl using the MIME::Base64 module, the code would be as follows:



use MIME::Base64;

print decode_base64("rTyna2yrqw2ADGHsghis ==");



You can get the MIME::Base64 Module from www.cpan.com .After it has be decoded, you will

see something like the following: "ankit.fadia:passwordhere"

The first two fields would be my username and the last field is my password is plaintext.



BIOS Passwords


This is a password hack but is just clears the BIOS such that the next time you start the PC the

CMOS does not ask for any passwordSay at school the floppy drive has been disabled and you

want to do your project at home and copy it to the floppy drive and use this floppy to transfer it to

the school computer.What do you do.

In most cases the BIOS is configured to disable the Floppy Drive. Now if you are able to bring the

DOS prompt in school the you will be able to change the BIOS setting to the default and enable

the floppy drive which is the default setting. In DOS there is the debug command which allows us

to do.To clear the CMOS do the following:

Got DOS and type:

DEBUG hit enter

-o 70 2e hit enter

-o 71 ff hit enter

-q hit enter

exit hit enter

Restart the computer

It works on most versions of the AWARD BIOS.

Tuesday, September 11, 2012

Installing Slackware Linux


 Installing Slackware Linux 


Slackware Linux is one of the oldest Linux distributions remaining. Over the years, it has stayed true to its roots and form.

for more info:

http://www.slackware.com/info/

The Slackware Philosophy


Since its first release in April of 1993, the Slackware Linux Project has aimed at producing the most "UNIX-like" Linux distribution out there. Slackware complies with the published Linux standards, such as the Linux File System Standard. We have always considered simplicity and stability paramount, and as a result Slackware has become one of the most popular, stable, and friendly distributions available.

What's this about "friendly"? You heard that Slackware was too damned hard, didn't you? If you are expecting cute graphical wizards and penguins automating every configuration step for you, that may be true. However, in essense, Slackware is one of the simplest distributions there is if you are proficient with a Linux system. If you aren't, a little perseverance with Slackware and you will be.

The reason it is easy for an experienced user is, first of all the init scripts and configuration files are easy to follow. They are generally well commented and it's easy to make changes using an ordinary text editor.

Not only that, you are getting the full, complete, standard releases of software in this distribution, installed in a sane manner. The way the developers intended. Therefore, when you go to install additional software not provided by the distribution vendor, you don't run into as many snags.

The packaging system in Slackware is quick, dirty and simple too. Slackware packages (.tgz files) are basically just tar.gz archives, that have install scripts that the packaging utilities execute. No dependency checking, which can be good or bad, depending on how you look at it. To me it's good, because I don't get annoyed by packages that won't install because of some brain dead mechanism that checks for things in specific places. The catch is, you need to be a bit careful installing system software.

Slackware also provides an excellent environment for building your own software from sources.

I could go on at length about why you should give Slackware an honest try but I'll let you follow this guide and see for yourself. We are going to be installing Slackware 9.1, which is the latest release at the time of writing.

Starting the Installation


First of all, if you intend to dual boot with Windows, take care of that first. If you're starting with a fresh hard disk, create a partition for Windows, and leave the rest unallocated (unpartitioned). Install Windows first.

Boot with the first disk in the Slackware CD set. (or the first CD that you created from the ISO files you downloaded).

If your computer is unable to boot from the CDROM for whatever reason, it is also possible to create a floppy boot disk set for the installation. Read the file README.TXT in the bootdisks directory on the Slackware CD, as well as the rootdisks directory. In Slackware 9.1, this directory is on the first CD.

Once you boot with the installation media, this is the first screen you will see:



Most people with plain IDE systems, can just hit enter here, to load the bare.i kernel image. The README.TXT in the bootdisks directory, describes the precompiled kernel images available on the Slackware CD. If you have SCSI disks, you must read that file, because adaptec.s, scsi.s, scsi2.s and scsi3.s each contain drivers for different SCSI controllers.

So press Enter to load bare.i, or type the name of the kernel image you wish to load (e.g. scsi.s)

The kernel will boot, and then you will be instructed to log on as root.



Just type root and hit enter. You will not be prompted for a password at this time.

Now we must partition the disk. This is probably the trickiest part of Slackware Setup, for there are no point and click partitioning utilities provided. We are going to use the Linux Fdisk utility. It seems scary at first, a bit alien, but it's very easy to operate and you're unlikely to make mistakes if you follow the steps correctly, and do not write the tables to disk until you're sure. I have never had a mishap with this program, and it has never damaged any existing (Windows) partition table entries on the disk.

What I did here was, I hooked up a new Western Digital 40 Gb hard disk for this install. I booted with the Windows XP CD and during setup, created an 8 Gb partition, formatted it NTFS and blasted a quick Windows XP install on there so we can have a dual boot. I left the rest of the disk unallocated.

Fdisk must be invoked with the device name of the hard disk you wish to partition. In this case, we're using the primary master hard disk, so we use the /dev/hda devicename. Here is how IDE disks are named:

/dev/hda - Primary Master
/dev/hdb - Primary Slave
/dev/hdc - Secondary Master
/dev/hdd - Secondary Slave

Note that these do not refer to partitions or filesystems, but the hard disk devices themselves. (/dev/hda1, /dev/hda2 and so on, is how partitions are addressed)

SCSI disks are named /dev/sda, /dev/sdb, /dev/sdc and so on, according to which are first enumerated on the bus.

We need to type fdisk /dev/hda



Don't worry about the informational message about the number of cylinders. Unless you're installing a very old Linux distribution, the boot loader won't have a problem.

Now what? Press m to see a list of commands.



The first thing we want to do is press p to print (display) the partition table. We do this after every step, so we can see the results. Nothing is really changed, until we press w to write the partition table to disk.



There's our 8 Gb NTFS partition, /dev/hda1. The first partition on the disk, and in Windows terms, the active partition. It's going to stay that way.

The units (for Start and End) are in cylinders of 8225280 bytes. Just remember that each unit is rougly 8 megabytes (7.84 if you do the math). It's also displayed in blocks of rougly 1 kb. Don't worry about it, we will be specifying partition sizes in megabytes.

Now, how we partition depends greatly on personal preference. All you really need to install and run Linux is a root partition, and a swap partition. However, that's a fairly large chunk of disk and we can mount parts of the Linux filesystem on separate partitions.

This is basically how I would allocate this space, for use with Slackware. It's just the way I do things, you can choose other partitioning schemes and sizes. If disk space is tight, you should create only a root partition, and save some space for a swap partition. For example, if you have 4 Gb of space to allocate, create a 3.7 Gb root partition and use the rest for swap. That would be a half decent setup.

Using multiple partitions is a bit wasteful, because we have to allow room on each partition for growth. This may result in some disk space staying unused. Err on the side of caution, and allocate plenty of space.

This is what I would do for my own use:


1 Gb root partition (primary partition)
The root filesystem, contains system software and libraries, configuration data (/etc), local state data (/var) and all other filesystems are mounted under it.

Extended partition utilizing the rest of the disk
We then create logical drives on the extended partition.

1 Gb swap partition (logical drive)
Note that you probably don't need a swap partition that large but I like the extra insurance and I have plenty of space. It allows me to work on absolutely huge files, and provides extra memory addressing in the event of some sort of race condition. 256 Mb should probably be enough swap though, if disk space is tight.

8 Gb partition for /usr (logical drive)
Most all of your software and libraries get installed in /usr. It is useful to have a large partition for this.

2 Gb partition for /opt (logical drive)
"Optional" software can be installed here. For example, KDE will be installed to /opt/kde. I install some other software to /opt as well.

18 Gb (roughly) for /home (logical drive)
We use what is leftover, for /home. This is where the user directories are, and where users will store personal files. You may also install some software to /home if desired. I do, and I keep build directories there as well.

Now, we will start creating these partitions.

To create a new partition, press n



We are prompted to choose primary, or extended. We want to create a primary partition here. (though the root partition could be a logical partition on the extended)

Press p to create a primary partition.



We then have to give it a partition number. The Windows XP partition is already partition 1, so we have to choose 2

We are then prompted for the starting cylinder. We will be just hitting enter, to accept the default value. (the first available cylinder). We will be accepting the default starting cylinder for each partition we create. We will specify the ending cylinder, by specifying the size in megabytes. For the value of "last cylinder", we type +1024M to create a partition of roughly 1 gigabyte. Partitions have to end on a cylinder boundary (or waste sectors), and partitioning software automatically adjusts that.



Now, press p to display the partition tables, and you'll see what you've done so far. At this point, if you've made a mistake, simply press d and type the partition number that you want to delete (2 in this case... just don't touch partition 1 or you'll destroy Windows). Nothing has been written yet, you can just delete the partition you've created and repeat the last step. This is why we view the partition info at every step. If satisfied, proceed with the next step. At the command prompt, you can press q at any time to quit without writing anything to disk, if you've made a serious mistake and just want to start over.

Now we are going to create an extended partition, to act as a container for our logical drives.



Press n to create a new partition then press e to choose extended. Press 3 when prompted for the partition number and it will be designated as /dev/hda3. We will never be accessing this partition, just the logical drives we are going to create on it.

Note: How the partition numbers work is, partitions 1 to 4 are reserved for primary partitions. (the extended partition is considered a primary partition). It is an architectural limitation of PC BIOS partition tables, that only 4 primary partitions are allowed on a disk. You can have many logical drives though. Logical drives start being numbered at 5, in the Linux scheme.

Press enter when prompted for the first cylinder, to accept the default of the next available.

When prompted for the last cylinder, this time, simply press enter again. It will allocate the rest of the disk, ending at the last cylinder 4865.

Press p to display the partition tables.

Now we are going to create logical drives until we've used up the extended partition, starting with swap. I generally like to put swap in between the root partition and /usr.



You know the drill. Press n to create a new partition, but this time press l for logical. (In our case, we can't create any more primary partitions because we've already allocated the disk)

Note that we are not prompted to choose a partition number for a logical drive, as it will be assigned 5 as the first one.

Press enter to accept the default value of the first cylinder. For the last cylinder, I'll type +1024M to create a 1 Gb partition.

Press p to display the partition table, and note that our new partition is /dev/hda5. There will be no /dev/hda4, because there will be no more primary partitions on this disk.

Aside: Just so you understand how this works, let's say that when we created the extended partition, we didn't allocate the rest of the disk. We left some space unallocated. If we were to create a primary partition using that space now or some time in the future, it would become /dev/hda4.

OK, now, note the Id column in the display of the partition table. By default, when we create partitions they are of type 83, Linux Native.

We must change the partition type of the one we just created to 82, Linux Swap.



Press t to "change a partition's system id" and then press 5 when prompted for the partition number. (Following my partitioning scheme, that is. Use the correct number for your swap partition of course)

When prompted for the Hex Code (partition ID), if you were to press L, you would see a long list of possible partition types that the Linux fdisk utility is aware of.

Type 82 for Linux Swap, and hit enter. When you press p to display, you will see the change.

The rest of the partitions we'll create, will be the default type 83, Linux.



Press n to create a new partition. Choose l for logical. Press enter to accept the default first cylinder. For the last cylinder, type +8192M to create an 8 Gb partition for /usr.



Again, n for a new partition, and l for logical. Press enter for the first cylinder. For the last cylinder, type +2048M to create a 2 Gb partition for /opt.

Now, we'll allocate the last partition for /home.



When asked for the first and last cylinders, just press enter for both of those this time, as we're using up the extended partition.

If satisfied with your changes, press w to write the partition table to disk, and exit the Linux fdisk utility.



If you see a warning like that, restart the system (with the slackware CD). I am seeing that message, because I altered the partition tables on a live system (to get those screenshots easily), but I have seen similar warnings when writing the partition tables to disk if I've gone back and redone them after already writing. You should just see "Calling ioctl() to re-read partition table", and "Syncing Disks". You only need to reboot if there were warnings.

Note: I said I altered the partition tables on a live system. That means, the data on those partitions was effectively lost. The next reboot would have been oblivion. Not a problem because it was just a test install, and I planned to install the OS again (Slackware installs very quickly), but know that you can't adjust partitions on the fly, as the partitions must be formatted afterwards.

Take note of which partition devices you created to correspond with your mount points. You'll need to specify them, during setup.

Now we are ready to proceed with the Slackware installation.

Now that we have our Linux partitions created, at the root prompt we can type setup



This is the main setup menu. You can read the help if you like, but you can just skip down to ADDSWAP unless you need to remap your keyboard for some reason. Use the arrow keys to navigate, and enter to select.



It will detect your swap partition for you, format it (mkswap) and activate it (swapon)

Note: The hard disk devices in these screenshots are /dev/sda. Don't pay any attention to that, it's just because I took these screenshots from within a virtual machine. It emulates disks as scsi devices. Just know that's not the disk we partitioned in the examples above, so there's no confusion.

After completing a step, setup automatically takes you to the next step in sequence. Next, is to select the target partitions. Here is where we choose our root partition, and then choose mount points for the other partitions.



This is where we select our root partition (/). Following our partitioning example, that would be /dev/hda2.



Now it will prompt you to format the partition. I would choose to check for bad blocks while it's formatting.



Choose your desired filesystem. I like to use ext2 because it's a simple filesystem that's well matured, but you may want to choose ext3 to have a journaling filesystem.



Now it prompts to choose the inode density for the filesystem. Just hit enter to go with the default of 4096 unless you know what you are doing, and specifically why you want to do it.

If you just created a root partition and swap, you are done formatting now. If you created other partitions, they must now be selected, formatted and assigned mount points.



Swap doesn't show up in this list.



We are mounting this partition as /usr.

Continuing on, we are prompted to select, assign mount points and format the rest of our partitions in the same manner.





When finished, a summary is displayed



In the next step, you will be prompted to select the source media.



Hit enter to choose a Slackware CDROM, and it should detect it automatically.

In the next step, we are prompted to select package categories.



These govern which series of packages will be installed on the system. By default, all categories are selected except KDEI (KDE i18N internationalization). If you're just going to be using English/Western charsets you don't need to install KDEI.

For your first time installing Slackware, I recommend leaving all package categories enabled. You can just choose OK here.

Next, we are prompted to choose the "prompt mode", that is, the degree of interaction for installing packages.



Full, installs all packages in the categories you've selected, without prompting. This is what I recommend for your first Slackware install. Install everything, and you can easily remove packages you don't want later after you get a feel for things. I do know what I'm doing, but this is the option I normally use. It's just easier.

Newbie prompts for each package as they are being installed. I do not recommend this, as it is quite tedious. Also, you may not know what you want/need yet.

Menu is a bit better, as it lets you choose groups of related things.

Expert. If you know what you are doing, the expert prompt mode is an excellent way to choose exactly which packages you want installed on the system, prior to package installation. This really is good, it's not terribly confusing like similar package installation modes in other distributions.

The custom/tagfile options use tagfiles to automate a custom package selection. I've never used them. This would be handy if you were wanting to roll out the same installation on several machines though.

Choose full and watch the packages install non-interactively. It won't take very long, even on a relatively slow machine.



At some point during the package installation, you will be prompted to insert the second CD.

When the package installation stage completes, you are prompted to choose a kernel.



I recommend the CDROM option, and choosing the same kernel that you chose at the initial boot prompt when you booted with the Slackware CD. It got you this far.



Because I did these screenshots in a virtual machine that uses scsi emulation for the virtual disks, I had to choose scsi.s. On an IDE system, you probably either want bare.i or bareacpi.i (warning: acpi can cause boot problems if your BIOS implementation of ACPI doesn't jibe... this is why I recommend using the same kernel you chose at the initial boot prompt)

Next, you are prompted to create an emergency boot disk.



I highly recommend taking the time to create this disk, for it can be used to start the distribution if anything ever happens to your boot loader. You will be able to easily fix it, if you can start the system using this boot floppy.

You will now be prompted to create a symbolic link for your modem device.



If you have a modem, you can do that here. Saying "no modem" doesn't mean you can't use a modem, you can create the /dev/modem symbolic link later, or just use the appropriate device (e.g. /dev/ttyS1 for COM2)

Next, you will be prompted to enable the hotplug system. If you have such devices, say Yes, otherwise No is a good idea.



As you can see, it's possible for it to cause problems on some systems. Note the information on how to get out of the trap if it happens to you.

Now we are prompted to install the LILO bootloader.



You will most likely want to choose simple here. Choosing expert, will result in lilo not behaving as you expect and you'll have to manually edit the lilo.conf file (or run liloconfig from within the OS) to get the desired functionality back (e.g. it won't even prompt you to select an operating system). If you choose to skip the installation of lilo altogether, then you will only be able to boot into your Slackware system using the boot floppy that you created in the previous steps.

Next, you are prompted to choose the VGA (display) mode of your console, either standard VGA, or one of the VESA framebuffer display modes. The reason this is in the lilo configuration, is because the boot loader passes these parameters to the kernel on boot.



It is nice to have a framebuffer console for when you're not running XFree86, but if the framebuffer mode you've chosen doesn't work well with your display hardware, you could end up with an unusable display (until you fix it of course... you could boot with your boot floppy).

Consider choosing standard for now, to use standard VGA. You can change this parameter in your /etc/lilo.conf file later. If you're always going to be using the XFree86 GUI environment, it's not going to matter much anyways.

You are now prompted to enter any extra boot parameters, that lilo is to pass to the kernel.



He gives one very common example of why you might need to do this: If you have an IDE CD Writer. In the 2.4 kernel series, CD writing uses SCSI emulation and the kernel must know which drive is to use that mode, if both IDE-CD Support and IDE-SCSI support are to be loaded in the running kernel. The example of hdc, is for a secondary master. Use hdd if your writer is secondary slave.

Next, you are prompted to choose the destination for installing LILO. You will almost certainly want to choose MBR (unless you know what you are doing)



He says "possibly unsafe" because there are a few situations where writing to the master boot record is indeed unsafe. For example, if your bios doesn't support the capacity of the drive, and you have translation software installed (e.g. "MaxBlast" or "EZBios"). Another reason it could be unsafe is, if you are using another boot loader (e.g. System Commander, or Boot Magic). Also, before you ever write to the MBR (installing pretty much any OS), you must ensure that bios level MBR protection is disabled. (a.k.a boot virus protection, or "Trend ChipAway"). Installing LILO to the MBR, is the most common way that it is used and it is normally quite safe and can be used to start your Windows operating systems as well.

The "Root" option, to install LILO to the superblock of your root partition, is mainly useful if you intend to use another boot manager to invoke LILO.

Next, you are prompted to create a symbolic link for your mouse.



Even if you don't intend to use gpm, it's still useful to have a correct /dev/mouse symbolic link. This way you can just specify that device when you configure XFree86 after the OS is installed. I choose imps2 for my Logitech ps/2 wheel mouse.



I don't have much use for this (it's got nothing to do with using a mouse in the GUI), but if you wish to have mouse support at the console, you can load gpm at boot time.

At this point, you will be asked if you want to Configure your network. If you only have dial up networking, and don't even have a NIC, you can say No to that question for now, and you'll be prompted to configure your clock, timezone and set a root password. Alternatively you can proceed, and choose loopback. That is really what you should do, as then at least you'll set a hostname for the machine.

If you chose to configure your network now, the first thing you will be prompted for is a hostname. Enter something.



Now you'll be prompted to enter a domain name.



If you intend to participate as a member of a network that has a nameserver, you will want to enter your fully qualified domain name, ending in .com, .org, .edu or similar.

Otherwise just enter localdomain. In subsequent steps you can even remove that domain name. (That's what I do, for I don't really need to have one)

Next, you will be prompted to set up your computer's IP address.



If your network adapter connects to a cable modem, or a broadband router, or uses a PPPoE connection (PPP Over Ethernet... commonly used for ADSL Internet connections), then you probably want to choose DHCP to have your TCP/IP info automatically assigned.

If you choose DHCP, you will be prompted for a DHCP hostname. If you connect directly to a cable modem, you may need to specify your user ID here.



Otherwise, just leave it blank and hit enter.

Next, setup will prompt you to probe for your network adapter.



If it doesn't detect it, don't panic. It just means you'll have to figure out which kernel module your network adapter needs and configure the network later.



Ok, in this virtual machine, that's the virtual adapter it detects. It works. However, on the real Slackware installation, it doesn't automatically detect my D-Link 530TXS. Not a problem, because I know what kernel module it needs (sundance.o). That's something for later and we'll cover it then. It doesn't prevent us from configuring most of the network information though.

If you've chosen to use DHCP, a confirmation screen is what you'll see next. Your network configuration steps are completed.



Myself, I just configure my network statically, and I don't use the DHCP server on my router. So, if you choose Static IP instead of DHCP, this is how the configuration goes.

Enter your IP Address.



Enter your Subnet Mask



Enter your Default Gateway



Enter a Nameserver



Note: I'm just entering the IP address of my router here, it acts as a DNS proxy. The Primary and Secondary DNS servers of my ISP are entered in my router's WAN configuration. You will probably want to enter your ISP's Primary DNS server in this field, and then you can add more nameservers (e.g. the secondary) to your /etc/resolv.conf file later.

Now you will be prompted to confirm your network settings.



You can edit these settings from this dialog as well. For example, I want to remove the domain name "localdomain" altogether.

This concludes the network portion of setup.

After the network configuration, you will be prompted to configure your startup services.



Many of these are network server daemons, and if you are just using your computer as a workstation, you will want to leave most all of them disabled. You may want things like the CUPS print server.

Next, you will be prompted to configure your clock and timezone.





Next, you will be prompted to choose a default window manager, for when you start XFree86.



If you are new to Linux, select KDE for now, you can try some of the others later.

Now you're prompted to enter a root password.



Say Yes. You'll be prompted to type a root password twice, for confirmation.

Slackware setup is now complete. You will be prompted to exit setup and press ctrl-alt-del to reboot your machine.



After exiting, the CDROM tray will open, so you can remove the CD. You'll be back at the root prompt after that. Press ctrl-alt-del to restart the system, and boot Slackware for the first time!

When the system cycles, you'll be at the LILO boot prompt. This is still the virtual machine, but in the real installation on the IDE disk we partitioned, liloconfig didn't add my Windows boot choice to the lilo.conf file. So what I see is exactly the same. Probably because I used the NTFS filesystem. We'll be fixing that up soon, it's not difficult.



Hit enter to start Slackware Linux, and you'll be at the logon prompt. Type root as the username, and you will be prompted for the root password you set near the end of setup.



The first thing you should probably do, is create a user for yourself. You must not use the root user account for normal operation of the system. The Slackware adduser script makes this very easy, by interactively prompting you for information instead of making you supply it with switches on the command line.



Type adduser as root, and then you will be prompted to enter a username. Use lower case for the username.

For most of the prompts you will just want to hit enter to accept the defaults unless you have a specific reason. Let it default to the next available user ID, hit enter to use /bin/bash (unless you want to use another shell of course), accept the default home directory, and accept the default of no expiry date.

You may want to enter a "full name" (I like to pick something humorous). You will then be prompted to type the user's password twice for confirmation. A user can change his own password any time, using the passwd command.

The rest of the configuration steps can really be done in any order, according to what is most important to you. You may want to get the XFree86 GUI started first, so you can use GUI based text editors and such, if you're unfamiliar with working from the command line.

The first thing I'd want to do is get my network going (if it isn't already). The netconfig utility that ran during setup, could not probe for my network adapter. However, I know that it uses the sundance module. How did I know that? Well, when I first bought those NICs, I typed D-Link 530TXS Linux (the "S" is significant in the model number) into a search engine (Google) and found the tidbit I needed in mailing list archives and the like.

Now, during setup we configured our network with the exception of the driver module for the network adapter. That means, all we have to do is load the module, and start the network. Slackware's startup scripts look for a script file named rc.netdevice in the /etc/rc.d directory. This is where the system init scripts are located on Slackware system. (It uses the BSD style init script mechanism)

It is very easy to create this file from the command line. As root, type:

echo "/sbin/modprobe sundance" > /etc/rc.d/rc.netdevice

This will redirect the output of the echo command into the specified text file that will get created. The quotes are important, because there is a space in the string we are echoing. Use the correct module name for your network adapter, of course.

Now, set the file executable:

chmod 755 /etc/rc.d/rc.netdevice

That's it, on the next reboot your network should initialize.

Alternatively, to load a network adapter module, you could uncomment the appropriate module loading line (or add one) in the /etc/rc.d/rc.modules init script.

Now, I don't feel like rebooting at the moment, so I'm going to just type a few simple commands to start the network.



I'm loading the module, then using the ifconfig utility to specify the interface, IP address of the machine, and subnet mask, and then using the route command to specify my router as the gateway.

You probably will want to attempt to start the XFree86 GUI now. By default, Slackware is set up to use the VESA Framebuffer driver for your display hardware. The /etc/X11/XF86Config file is a copy of the file XF86Config-vesa in the same directory.

So if you type startx you may have a usable GUI if the settings are compatible with your display hardware. That will do in a pinch, but you will want to properly configure XFree86 and use the accelerated driver for your video card (which hopefully exists, otherwise you've got some generic options)

I put the XFree86 configuration for Slackware in a separate tutorial, which you can read here:

Configuring XFree86 in Slackware (Opens in new window)

Next, I want to get LILO straightened around, so I can boot that Windows XP installation. At this point I have no way of starting it.

As root, open the /etc/lilo.conf file with a text editor. I drew a box around the section that I added, to the bottom of the file.



Lines that start with # are comments, and are ignored.

This is called "chainloading". What we are doing, is instructing LILO to pass control over to whatever code is in the /dev/hda1 partition's boot sector. It does not have to know anything about the filesystem or the operating system on the partition. In this case, that's the code in the boot sector that finds ntldr; Windows XP's own boot loader. Any additional Windows operating systems that the Windows XP boot loader's boot.ini file is configured to start (e.g. Win9x) will be available from the ntldr menu as well.

What you will see in the LILO boot menu, is the label windows.

While you are editing lilo.conf, you probably will want to change the timeout to a more reasonable value. It defaults to 1200, which is 2 minutes. (The value is in 10ths of a second, so a value of 300 is 30 seconds)

After you are finished editing the lilo.conf file, you must run the lilo command (or /sbin/lilo if /sbin isn't in your path) to rewrite the changes, or they will have no effect.

As root, type lilo and you should see in the output that it has added both Linux and windows to the configuration.

I rebooted the machine, and I can start both Linux and windows.

If you ever want to access that NTFS filesystem from within Linux (read-only support for NTFS), you will have to load the ntfs kernel module, and mount the filesystem.

Create a mount point (an empty directory)

mkdir /mnt/windows

Load the kernel module.

modprobe ntfs

Mount the filesystem.

mount -t ntfs /dev/hda1 /mnt/windows

You access it from /mnt/windows.


Slackware 9.1 ships with the ALSA (Advanced Linux Sound Architecture) system. I had never really used it before, beyond manually loading ALSA kernel drivers without having any of the utilities installed. It's considerably more complex than the older OSS (Open Sound System) drivers, requiring more kernel modules and module aliases to be set up in a modules.conf file. I thought I was going to really hate it, but when I saw how easy it was to configure, I had to re-evaluate that.

As root, type alsaconf and a curses based configuration utility will appear.



It probes for your sound card.



Offers to set up your modules.conf file for you.



Some nice informational messages.





That should be it, your audio should now work!

If that doesn't work for you, then it will be manual configuration. Check the Alsa Soundcard Matrix to see if your card is supported, and what module to use.

http://www.alsa-project.org/alsa-doc/

As for configuration, this is what you'll want to put in your /etc/modules.conf file. The lines should pretty much be the same for all sound cards, but what you must change is the driver module, which I have shown in bold.

quote:
# Stuff for the kernel module loader
alias char-major-116 snd
alias char-major-14 soundcore
# Your Driver
alias snd-card-0 snd-ens1371
alias sound-slot-0 snd-card-0
# OSS Emulation
alias sound-service-0-0 snd-mixer-oss
alias sound-service-0-1 snd-seq-oss
alias sound-service-0-3 snd-pcm-oss
alias sound-service-0-8 snd-seq-oss
alias sound-service-0-12 snd-pcm-oss


Some cards may need additional modules or options. See the "details" section for your card, at the Alsa Soundcard Matrix.


Let us know your comment ...