home *** CD-ROM | disk | FTP | other *** search
/ The Hacker's Encyclopedia 1998 / hackers_encyclopedia.iso / hacking / unix / unix1.hal < prev    next >
Encoding:
Text File  |  2003-06-11  |  9.9 KB  |  198 lines

  1.  
  2. ===============================================================================
  3.                                 RUSH2112
  4.                                 Presents
  5.                            A HALE Production
  6.         H ackers        A gainst           L aw        E nforcement
  7.                      Call HALE Hq. (619)660-67xx
  8.         Active HALE members are: Ripper, Trashman, Rush2112.
  9.         The Underground Newsletter: Vol I.  Issue I, Part I
  10. ===============================================================================
  11. Note:    Feel free to distribute the file provided none of its contents or 
  12.     credits are changed.
  13. Topic:    A Guide to Unix Systems, Part I.
  14. Date:    September 1, 1989.
  15. Foreword:  This file is compiled from my experiences on both BSD and Sys V 
  16.        Unix on VAX 750/780 mainframes, AT&T 3B20 and Pyramid Technology's
  17.        mainframes.
  18.  
  19.     In today's world, as a hacker, you are nothing unless you learn some
  20. of the more popular operating systems around used on minis, mainframes, super-
  21. computers and the like.  In this file I will attempt (to the best of my 
  22. ability) to introduce you to one of those operating systems - namely - the
  23. world of Unix.  It is hoped that by reading this file you can pick up perhaps
  24. enough of a working knowledge so that if by chance in your hacking exploits you
  25. come across a Unix system (and you will) you'll know what to do.
  26.     There is NO WAY to cover everything about Unix in a file so this will
  27. be the first of many that I hope to release in the future.  If I find there are
  28. stuff I have not mentioned I will write more files as needed.  In Part II, I
  29. plan to give you a tutorial on what to do while you're on-line in regards to
  30. hacking and using essential system utilities.  Have fun.
  31.     Usually (unless modifified by the system administrator or one with such
  32. privileges), you can tell if you've connected to a Unix system of some type by
  33. the login prompt which looks like this:
  34.  
  35. login:
  36.  
  37. Pretty simple huh?  Anyway, that is the standard login prompt, it may or may
  38. not be preceded by a message telling you what type of Unix or system you have
  39. connected to. 
  40.     If you try to login with an illegal login name and/or an illegal
  41. password the system will respond as such and as you to try again:
  42.  
  43. login:hacker
  44. password:
  45. login incorrect
  46. login:
  47. (Note the password is not echoed in any form)
  48.  
  49.     In Part I of this Unix tutorial I'd like to start with an overview of 
  50. the Unix system before I get into some of the more interesting stuff (so bear 
  51. with me all you Unix experts).  Then I will go through the login process and
  52. the /etc/passwd file and how it is structured.  This will not be an in-depth
  53. look at all, merely an overview.  Some day I will write an in-depth study to
  54. accompany this file and the files that follow for the more advance user/hacker.
  55.  
  56.     There are basically 2 types of Unix systems that you will most likely 
  57. come across.  They are:
  58.  
  59. I.  BSD Unix - from UC Berkeley's (B)erkeley (S)oftware (D)istributors
  60. II. System V UNIX - from AT&T (how nice - I know all you phreakers are smiling!)
  61. (Other spinoff's of the above 2 will not be discussed - such as Ultrix,
  62.  Minix, Xenix, etc...)
  63.  
  64.     They are alike in many respects but both have their differences, hence
  65. their are advantages and disadvantages to both of the systems, BSD and Sys V.
  66. Perhaps the main difference between the two are the default shell that each
  67. uses as the user interface to the system utilities.
  68.     BSD Unix defaults to the csh (C-Shell) while AT&T's Sys V uses the sh
  69. (Bourne shell).  But on both of these systems both shell types are available to
  70. the user.  A third optional shell which is also pretty popular is the ksh 
  71. (Korn shell).  The way to recognize the default shells when you see them is by
  72. their default prompt.  The csh uses the % symbol as the prompt while the sh
  73. uses the $ symbol as the prompt.
  74.     Now let's talk about files, shall we?  The MOST important file of all
  75. on ANY UNIX system is the password file.  This file holds information about 
  76. all the accounts on the system, passwords, and other information.  Without 
  77. this file no one can log in and use the system.  You can find this file on any
  78. system in the /etc directory.  It is called simply 'passwd'.  The full 
  79. pathname is /etc/passwd (of course).
  80.  
  81.     The /etc/passwd file is stuctured as such:
  82. Each user has an entry in the passwd file that holds his account information.
  83. Among the information included on each user entry line is his login name,
  84. his password (encrypted), his user id, his group id, his home directory, his
  85. name, and his startup program if any.   Basically it looks something like this:
  86.  
  87. ------------------------ Sample /etc/passwd file  -------------------------- 
  88.                General format of each entry:
  89. login:password:user-ID:group-ID:info:home directory:startup program
  90.  
  91. root:Arllz76Dnq:0:0:The & of All Evil:/:/bin/csh
  92. jsmith:Yi83amq9:102:100:John Smith:/usr/jsmith:/bin/sh
  93. who::99:500:Who's on:/usr/ucb:/bin/who
  94. daemon:r6Eeu:1:1:The DEVIL himself:/etc:/bin/csh
  95. bin:mb033yt:3:3:The Keeper of the Flame:/etc:/bin/csh
  96. info::508:501:Library user group:/usr2/info:/usr2/bin/rsh
  97. .....
  98. ..... [ and so on ]
  99. .....
  100. ----------------------------------------------------------------------------
  101.     Now we'll examine each entry.  Remember that each field is separated 
  102. by the colon.  So in the first entry in /etc/passwd given above, we can tell 
  103. the following about the  entry.
  104.  
  105. login name is:        root
  106. Password (encrypted):    Arllz76Dnq
  107. User ID:        0
  108. Group ID:        1
  109. Info (usually owner):    root
  110. Home Directory:        /
  111. Startup Program:    /bin/sh
  112.  
  113. The second entry in /etc/passwd looks like this:
  114. login name is:        jsmith
  115. Password (encrypted):    Yi83amq9
  116. User ID:        102
  117. Group ID:        100
  118. Info (usually owner):    John Smith
  119. Home Directory:        /usr/jsmith
  120. Startup Program:    /bin/sh
  121.  
  122.     But now you get the general format...so let's discuss some things
  123. about the field.
  124.  
  125. I.    The login field
  126.    This is the login name that you use to login at the prompt of the Unix 
  127. system.  During the login process, after you enter the login and the password
  128. the system will then call routines to search the 1st field of each entry
  129. in /etc/passwd to see if any login names match up with the one you have given
  130. it.  If none exists it will report the "login incorrect" message and start
  131. prompting for a new login name and new password.
  132.  
  133. II.    The Password field
  134.    If the login name is valid, Unix then takes your password entry and encrypts
  135. it then compares it against the encrypted password in the 2nd field of the 
  136. login name entry (see I.  The login field).  If the two passwords match up, the
  137. login process will continue, otherwise the "login incorrect" message will be 
  138. displayed.  I'll explain later what goes on when comparisons of the encrypted
  139. passwords take place.  If the Password Field contains null :: then no password
  140. is needed and the system logs you into the home directory and executes the 
  141. startup program.  If the Password Field contains :,.: then upon login the
  142. system will run the passwd utility and assign that account a password.  (This
  143. is nice if you're a system administrator, you create an account for your 
  144. friend then put the ",." in the password field and he'll set his own password
  145. upon login.
  146.  
  147. III.    The UID (UserID) field
  148.    If everything is correct (login name and password) then the system proceeds
  149. to put your in your home directory.  You are then given a UID from your entry
  150. in the /etc/passwd file.  All UID's fall in the range 0-65535 with 0 as the 
  151. superuser UID (see /etc/passwd example).  The system reserves UID 0-99 for 
  152. special accounts.  UID's are used by the system and its utilities to control 
  153. both access levels and file ownership (as determined by the ls utility - more 
  154. on that later).  
  155.  
  156. IV.      The GID (GroupID) field
  157.    The Group ID is used to associate the user with a certain group, used by
  158. Unix primarily for access levels as determined by file protections.  (i.e.
  159. a member who is not in a group can not get group privileges on files for that
  160. group, even though file protections for the file say all privileges to group
  161. users.)  GID's fall in the range 0-655535 with GID 1 being the default.  All
  162. GID's between 0-99 are reserved.
  163.  
  164. V.      The Information field
  165.    This field usually holds the account owner's    name though it can be used
  166. for anything actually.   I have seen it used to describe the account function
  167. (see the sample /etc/passwd file on the entry for login name "who"), and also
  168. to hold people's phone extension, etc..
  169.  
  170. VI.      The Home Directory Field
  171.    This field should have the full pathname to your home directory.  On many
  172. UNIX systems it is usually in the format of /usr/{loginname} (See the
  173. entry for login name "jsmith").  Not necessarily your PERMANENT home 
  174. directory, one can change it by reassigning an alternate path to the system
  175. variable $HOME (on Sys V). 
  176.  
  177. VII.      The Program Field 
  178.    Usually this field holds the startup program to execute once the login
  179. procedure has been completed.   If left blank then the default startup program
  180. will be the shell assigned to the Unix system.  In the our example /etc/passwd
  181. file, the entry for login name who, will execute the who command in /bin/who
  182. once you log in.  However, after the command finishes executing, it will exit
  183. the system as there is no password on the account, there is no way to stay
  184. logged in.  On the info account however, you will remain login until you type
  185. exit or logout or CTRL-D as the program running there is a shell.  Though not
  186. a full Bourne shell or C-shell, the restricted shell (rsh) does allow to you
  187. play around a little.  
  188.  
  189.     Well, that about does it for what I want to cover in Part I.  Look for
  190. Part II coming out real soon.  I will be going into details what to do once
  191. online with an account and how to go about getting an account.  This file is
  192. for informational purposes only.
  193. ------------------------------------------------------------------------------
  194.  
  195. Brought to you by: The Apple Bandit 10-89
  196.  
  197.  
  198.