home *** CD-ROM | disk | FTP | other *** search
/ The Hacker's Encyclopedia 1998 / hackers_encyclopedia.iso / hacking / unix / discrete.doc < prev    next >
Encoding:
Text File  |  2003-06-11  |  93.6 KB  |  2,089 lines

  1.  
  2.                    ///////////////////////////////////////////
  3.                   // Baldrick's guide to discrete UNIX use //
  4.                  //     Complete with Internet babble     //
  5.                 ///////////////////////////////////////////
  6.  
  7.                  First edition: Never before released in
  8.                                 any bloody form.
  9.  
  10.                Volume 1:  The story so far....
  11.  
  12. ==============================================================================
  13.  DISCLAIMER:  I didn't write this file.  Someone else did and framed me using
  14.               my pseudo so I'm obivously not liable for any of it.  He went
  15.               that way.
  16.  
  17.  TEASER:  If you really liked this file then just wait a bit and if I figure
  18.           out any new and funky interesting tips I'll put them out too in a
  19.           text phile series that would make Maury Pauvich turn green.
  20. ==============================================================================
  21.  
  22.                                  //////////////
  23.                                 ///Contents///
  24.                                //////////////
  25.  
  26.     (if you wanna find it quick, search for the contents number x.x)
  27.  
  28. 1.0    Introduction (aka mindless self-indulged ego statements and pseudo-
  29.                       visionary babble about the realisation of Cyberspace)
  30.  
  31. 2.0 UNIX from DOS in thirty minutes or your money back
  32.  
  33.     2.1     Logging in and logging out
  34.     2.2     Basic file manipulation
  35.     2.3     The manic man command
  36.     2.4     Reaching Nirvanna through ed(1) (text manipulation)
  37.     2.5     Intra-system communication - who, finger, write, talk, etc.
  38.     2.6     Multitasking without L.S.D.
  39.     2.7     Security - file permissions and chmod
  40.  
  41. 3.0    Playtime on your local system
  42.  
  43.     3.1     aliasing commands
  44.     3.2     Shell scripts (incl. ~/.*)
  45.     3.3     Changing your default shell and the tcsh shell.
  46.     3.4     Causing mindless havoc through write and other childish tricks
  47.     3.5     The Importance of Being Earnest (hiding what you are doing)
  48.     3.6     cat /etc/passwd > ~/lab7.h
  49.     3.7     Security - A couple of cunning plans
  50.  
  51. 4.0    Reach out and touch someone (playing with the Internet)
  52.     4.1     finger, talk, and mail to remote clients
  53.     4.2     USENet newsgroups
  54.     4.3     telnet and rlogin
  55.     4.4     FTP and FSP
  56.     4.5     Gopher
  57.     4.6     MUD, MUSH, MUCK, MUSE, IRC
  58.  
  59. 5.0    Piracy and Internet
  60.     5.1     The Internet Pirate:  Scourge of the Network
  61.     5.2     Getting Contacts
  62.     5.3     Information Trading
  63.     5.4     Paranoia (how to not get caught)
  64.     5.5     Aside: Faking Mail
  65.     5.6     Aside: Naughty Pictures
  66.  
  67. 6.0    Onwards to Victory
  68.  
  69.  
  70.                        //////////////////////
  71.                     // 1.0 Introduction //
  72.                       //////////////////////
  73.  
  74. So I wanna be a guru...   A couple years ago, the foolish computer science
  75. faculty at my post-secondary institution were nice enough to give me my very
  76. own spanking new UNIX account.  After spending the first afternoon buggering
  77. around typing the only command I thought I knew ("sh us", actually a VMS
  78. command that had somehow sprung into my head), I gave up the cause of getting
  79. any information for lost.
  80.  
  81. My lethargy soon lifted, however, and I set out on a quest to get some
  82. information on UNIX. The computing services people graciously provided me
  83. with two duplexed photocopy sheets of information, and I supplemented that
  84. with Brian Kernaghan's "A Beginner's Guide to UNIX" and then I was on my way.
  85. Now it seems that lots of people I know are just getting into the UNIX
  86. / Internet thing and want to know how to USE it.  Not how to read their mail
  87. and play MUD, but all sorts of things that go on slightly under the table...
  88.  
  89. "I don't know much, but here's something to get you started" I invariably
  90. reply to these people and promptly wear myself out typing page after page of
  91. "Oh, P.S. - you might also want to ..." statements.  And so, I've set out to
  92. create what you have before you - Baldrick's guide to discrete UNIX use.
  93. This is an attempt at answering all the questions I had when I was learning
  94. and couldn't find the answers.  I was very lucky to know some people who
  95. dropped me hints and put up with my whining - the best way to learn UNIX is
  96. apprenticeship it seems (the guild system alive and well?).
  97.  
  98. To close off this lofty and drab introduction, I'd like to offer ceremonial
  99. gold stars for cooperation and UNIX knowhow to Gollum, without whom I would
  100. probably be hanging out in #esperanto. Thanks also to Puzzling Evidence, who
  101. although by his own admission "UNIX dumb" managed to find out a hell of a lot
  102. and write a damn good article about it before I was even a sparkle in the
  103. great big Computing Services martini.  Stingray also gets some honorable
  104. mention for his general smarts in UNIX nastiness.
  105.  
  106.  
  107.          /////////////////////////////////////////////////////////
  108.         // 2.0 UNIX from DOS in ten minutes or your money back //
  109.        /////////////////////////////////////////////////////////
  110.  
  111. 2.1 Logging in and Logging out
  112. ------------------------------
  113.  
  114. You begin here.
  115.  
  116. There are two obvious ways of getting onto a system to log in - one is by
  117. using an ever-so-stylish terminal, and the other is by actually phoning in
  118. from home using communications software.  There are usually machine-specific
  119. ways of doing each (wake-up commands for the terminals, and wierd tripped out
  120. modem settings like 9600 7O1) which you will have to find out from whoever
  121. gave (stole?) you an account.
  122.  
  123. When you do finally get connected to the UNIX system, you will see a header
  124. resembling this:
  125.  
  126. SunOS UNIX (systemid)
  127.  
  128. login:
  129.  
  130. The login: prompt is the infamous hallmark of a UNIX system.  You will have
  131. a user id which can be up to 8 characters and which is typed entirely in
  132. lower case.  This is often your first initial followed by your last name (or
  133. the first seven letters of it).  Once you have entered a login id, regarldess
  134. of whether it is right or wrong, you will see the prompt
  135.  
  136. Password:
  137.  
  138. and you must enter a password.  This is case sensitive (as is everything in
  139. UNIX) and not echoed as you type.  Assuming you get everything right, you
  140. should be rewarded with the login message; if you screw something up then
  141. you'll end up seeing the rather unpleasent
  142.  
  143. Login incorrect
  144.  
  145. login:
  146.  
  147. and you'll get to try again. Most systems get tired of you after four or five
  148. attempts and will drop the connection with a curt "too many attempts / bye".
  149.  
  150.  
  151. Once you've gotten past the login part, the UNIX system will automatically
  152. display any prominent bulletins from the administration (these are
  153. stored in the file /etc/motd if you ever need to see them again), and then
  154. proceeds to log you in according to the settings you have recorded in your
  155. .cshrc and .login scripts (these are usually preset for you, but you may want
  156. to play with them and customize things.  More on this later - see section 3.2).
  157. You may be asked to enter your terminal type (vt100 or vt220 are often the
  158. standards) while this process takes place, and you may be notified of any new
  159. news in the newsgroups you are subscribed to, along with any mail you have
  160. waiting.  If all goes well you will either end up in the shell - your command
  161. prompt.
  162.  
  163. UNIX comes with two default shells: the bourne shell (prompt is a dollar
  164. sign, '$') and the C Shell (prompt is a percent sign, '%').  On all the
  165. systems I've used, the C shell has been the default.  Often the prompt also
  166. includes the name of the machine (but not the current directory, like a $p$g
  167. in DOS).  Most systems also have the "tcsh" shell, which is an advanced
  168. version of the C-Shell with some nifty features.  More on using that
  169. later.
  170.  
  171. From here, you are free to explore with any of the topics mentioned
  172. elsewhere.  Keep in mind that when you want to quit, just type 'logout' to
  173. logoff the system.
  174.  
  175. To change your password at any time, simply enter the command, "passwd" at the
  176. prompt.  UNIX will ask you to type your old password, and if you get it right
  177. you will be able to enter a new one (you will also be asked to type it again
  178. for verification).
  179.  
  180. 2.2 Basic File Manipulation
  181. ---------------------------
  182.  
  183. Here I'll basically tell you the equivalents of your favourite DOS commands.
  184. To get full (but alas totally incomprehensible) help on ANY UNIX command, type
  185.  
  186. man [command]
  187.  
  188. man stands for the UNIX online manual.
  189.  
  190. *Command: ls        In DOS:    dir
  191. In UNIX, ls (a prophetic abbreviation for LiSt files) will list the files in
  192. the current directory.  Simply typing ls will give you a terse listing of
  193. filenames only (a lot like a dir /w).  By default, UNIX does not display any
  194. file beginning with a  period "." character (this is used so you don't have
  195. to see administrative files every time you do an ls command.)  Typing ls -a
  196. will show ALL files, including these hidden files.  Typing ls -l will display
  197. a listing in a long format, more similar to a normal DOS dir command.
  198. You can combine these options: ls -al will list all files, in long format.
  199. A useful additive is ls -F; this will mark all direcotires with a
  200. trailing slash (eg:  dirname/ ) in an ls listing.  this is a faster way
  201. of identifying directories than using ls -l.
  202.  
  203. *Command: pwd           In DOS: cd with no arguments
  204. pwd stands for "print working directory".  This is the best way to find out
  205. where in the hell you are.  It's quite easy to get lost on a mainframe system
  206. when changing directories raplidly; pwd will tell you what directory you are
  207. in by displaying the path from the root)
  208. You start in your Home Directory - this is your personal space to put Stuff.
  209. You can get info about your privelages by using the du and quota commands:
  210.  
  211. *Command: du        In DOS: No equivalent
  212. du will simply tell you how much disk space the files in the current directory
  213. are taking up.  It's handy to let you know where all your home directory space
  214. has gone.
  215.  
  216. *Command: quota        In DOS: No equivalent
  217. Use the command:
  218.  
  219. quota -v
  220.  
  221. to get information on your space restrictions.  you will usually be shown how
  222. much space you were given, and your maximum limit (usually you are allowed to
  223. go over by 100K or so, but you get nasty messages if you keep this much Stuff
  224. in your directory.  If you go over the limit, you will not be allowed to save
  225. any more Stuff.
  226.  
  227. *Command: cd        In DOS: cd / chdir
  228. cd is the basic method of changing directories.  Like in DOS, a single period
  229. '.' stands for the current directory (and can be used as a command argument)
  230. and a double period '..' stands for the parent directory (one level up).
  231. Unlike DOS, diretories in a path are seperated with FORWARD not backward
  232. slashes.  This will drive you absolutely nuts every time you shell to DOS
  233. from your communication program and try to change directories.  Furthermore,
  234. in UNIX, you have one extra symbol you can stick in a path.  The tilde
  235. character (~) stands for your home directory - this is very useful in a huge
  236. file structure such as you often find on mainframe systems.
  237. Examples:  cd ~/mystuff/textdir
  238.        cd ../../incoming
  239.  
  240. *Command: cp        In DOS: copy
  241. cp is equivalent to the DOS copy command.  The only difference is that you
  242. MUST use two arguments: cp f1 f2  ; you cannot just leave off the second one
  243. and expect UNIX to default to the current directory.  (to achieve this you
  244. just use '.').  Thus, you cannot type 'cp News/rec.arts' and expect that
  245. file to pop into your current directory - you'd have to type one of the
  246. following:
  247.     cp News/rec.arts .
  248.     cp News/rec.arts rec.arts
  249.     cp News/rec.arts newname
  250. This command also brings us to the topic of the * wildcard character.  UNIX
  251. is quite a bit more versatile than DOS here - you can use a * parameter by
  252. itself to indicate you want all files, or even take a *.txt for example,
  253. which will even allow you to get files like this_has_a-longName.txt.
  254.  
  255. *Command: mv        In DOS: ren (well, sort of)
  256. The mv command moves the first file argument to the second file argument.
  257. You can use this to rename files, or to move them around.  Just like the
  258. cp command, you MUST use two arguments.
  259.  
  260. *Command: rm        In DOS: del or erase
  261. The rm command will ReMove a file.  There is no warning before it does it and
  262. it's pretty much irreversable (Central Point Undelete can't help you now that
  263. you've left Kansas). Even more annoying, you can type rm * and kill EVERYTHING
  264. very quickly without an 'Are you sure' prompt.  It is sometimes a good idea
  265. to call rm with the -i switch so that it confirms each deletion seperately.
  266. It is actually an even better idea to alias it to always use the -i switch -
  267. see section 3.1.  You can remove a DIRECTORY and all its contents (no
  268. verification) by using rm -r [dirname].
  269.  
  270. *Command: mkdir    In DOS: md or mkdir
  271. mkdir functions the same as in DOS - it creates a subdirectory in the current
  272. directory.
  273.  
  274. *Command: rmdir        In DOS: rd or rmdir
  275. rmdir will remove an EMPTY directory, the same as the equivalent DOS
  276. command.  Similarly, if there are still files in the directory rmdir will
  277. display an error message.  Use rm with the -r switch to remove a directory
  278. and contents.
  279.  
  280. *Command: cat        In DOS: type
  281. the cat command will display the contents of a file to the screen with no
  282. formatting and no pauses - it functions exactly the same as the DOS type
  283. command.  Similarly in DOS and UNIX, if you try to display the contents of a
  284. binary file you may get unpredicatble results and you probably won't get to
  285. see the whole file contents.  Cat is often used in conjunction with the UNIX
  286. pipe and redirection commnands.  These commands exist in DOS where they are
  287. seldom used; in UNIX they're extremely useful and you will want to use them a
  288. lot.
  289.  
  290. *Command: >, <, |  In DOS: <,>,| - file redirection and pipes
  291. You can send the output of a command to a file by using the redirect output
  292. (greater-than sign, '>') command.  For example, you can crudely copy a file
  293. by using this command:
  294.  
  295. cat [file1] > [file2].
  296.  
  297. (This is useful when you have read permissions to a file but not exec
  298. permissions and you can't copy it  with the cp command but can display it
  299. with cat).  Similarly, you can redirect the input to make it a file rather
  300. than the  'standard input'.  This is done with the input redirection (less
  301. than sign,'<') command.  For example, you could issue the command:
  302.  
  303. ed /etc/passwd <rootscript >newpsswd
  304.  
  305. Which would run ed on the /etc/passwd file, issuing the commands as you have
  306. typed them into the file rootscript, and then output any messages to newpsswd.
  307.  
  308. Using the symbol '>>' will append to the destination file rather than
  309. overwriting it as you would with '>'.  So you can:
  310.  
  311. crack <passwd >>valids
  312.  
  313. You get the idea...
  314.  
  315. The pipe command "|" allows you connect the output from one program to the
  316. input of another.  For example:
  317.  
  318. ls -al | stripblanks >>outfile
  319.  
  320. would run the executable 'stripblanks' with its input as the output of the
  321. 'ls -al' command, and the output from stripblanks is appended to the file
  322. 'outfile'.
  323.  
  324. *Command: grep        In DOS: No equivalent
  325. grep is a useful command that lets you pick needles out of haystacks.  The
  326. syntax is:
  327.  
  328. grep [<">pattern<">] [filename]
  329.  
  330. You type a pattern to search for (use quotation marks around it if it
  331. contains any spaces) and a filename and grep will dispaly all the LINES in
  332. filename that contain the pattern.  For example,
  333.  
  334. grep root /etc/utmp
  335.  
  336. Will find and display all lines with the pattern "root" in the file /etc/utmp.
  337. Using grep on a binary file can have unpredictable results.  grep is
  338. especially useful for files where one record takes up one line - it allows
  339. you to quickly get the information you need.
  340.  
  341. *Command: history    In DOS: No equivalent
  342. History allows you to see what the past 10 commands (10 by default) that you
  343. typed are.  Each command is numbered although the system usually saves only
  344. the last 10.  You can turn off this saving of commands by using set history=0
  345. (this is not available on BSD UNIX, but you can delete any incriminating
  346. history files by deleting the .history file in your home directory).  You can
  347. also opt to keep more or less than 10 commands using the set history= command.
  348.  
  349. *Command: !        In DOS: F3 and F1 do a little of this
  350. Typing !! will repeat the last command verbatim, like using F3 in DOS.  You
  351. can also type !23 and get command 23 (as it is shown in history) repeated.
  352. Or you can even type !gre and the last command with the pattern 'gre' in it
  353. (most likely a grep command) will be repeated.
  354.  
  355. With just those simple commands, you are able to perform most of the file
  356. manipulation you will need.
  357.  
  358. 2.3 The manic man command
  359. -------------------------
  360.  
  361. Invaraibly, you will reach the point where you will want to know more 
  362. than is found in this file.  Or, you will ask someone for help on 
  363. something, and they will say something to the order of:
  364.  
  365.    Just see vi(5) and blah blah blah blah.
  366.  
  367. In UNIX, the entire manual is online for you to use.  It's so absolutely 
  368. huge that you would never want the whole thing (indeed, when you see 
  369. printed copies they usually take up more kitchen counter space than June 
  370. Cleaver had in her house).  When people refer to programs as progname(#) 
  371. they are actually dropping you an estoeric UNIX hint about getting more 
  372. information.  The number in brackets is the section of the UNIX manual 
  373. (there are less than ten of these volumous beasts, I believe) which has 
  374. the information they are referring to.  To get that information you can 
  375. usually just type
  376.  
  377. man progname
  378.  
  379. In some cases, you will want to search in another section than what
  380. pops up - in this case just add the section number:
  381.  
  382. man vi 5
  383.  
  384. or something to that effect.  When you are reading the man pages, you 
  385. will probably be in either the "more" or "less" viewer programs.  You 
  386. can move around in these with the following keys:
  387.  
  388. Key:     Action:
  389. ----     -------
  390. (space)  Next page
  391. (enter)  Next line
  392. g        Beginning of file
  393. G        End of file
  394. n        Next Page
  395. b        Previous Page
  396. /sometxt Search for the next occurrence of "sometxt" (hit Enter to start 
  397.          the search).
  398.  
  399. With a little luck and some intuition, you can wade through the man 
  400. pages and find what you are after.  Keep in mind that they are complete 
  401. technical specifications for the commands, and are not necessarily 
  402. written to be easily understood.  Rather, they just list all the options 
  403. and blurb about the item in question in as much technical jargon as 
  404. possible.  Should you really need to pore over it, you might want to 
  405. pipe the manual into a file:
  406.  
  407. man more > more.man
  408.  
  409. This will create a file called "more.man" in the current directory, 
  410. which contains the manual pages for the command more(1).
  411.  
  412. 2.3 Reaching Nirvanna through ed(1) - Text Manipulation
  413. -----------------------------------
  414.  
  415. One of the chief commoddities that you'll be getting your grubbly little
  416. hands on using UNIX is information.  You need a method to keep all this
  417. Stuff, hence text manipulation.  I'll go over creating a file first, so you
  418. can have your very own to look at.  The easiest way to create a text file is
  419. through ed(1).  If you liked EDLIN, you'll love ed at your prompt, type:
  420.  
  421. ed [filename]
  422.  
  423. If [filename] is a new file you'll be told so, and then be left waiting.
  424. typing 'a' allows you to start adding to the file (though no indication is
  425. given that you have done so.)  Type away and then when you're finished
  426. enter a single period on a line by itself to end the input.  Now you can type
  427. one of the following commands:
  428. w - write to disk
  429. q - exit - if you haven't saved a ? is printed and you are given salvation
  430. p - list current line
  431. 1,$p - list first to last line ($ = the last line)
  432.  
  433. More archaic commands are available; see man ed for more help.
  434.  
  435. If this form of torture isn't entirely your scene then there is a much
  436. friendlier text editor available named vi (for Visual Editor), which you will
  437. immediately hate.  But given time you will really get to like it.  Call vi by
  438. typing vi [filename] and a nice screen will pop up with tilde marks down the
  439. left side and 'filename [New File] mm/dd/yy' at the top.  Now, I realise
  440. that there must be SOME vi help SOMEWHERE, but I can't find it.  So
  441. here's a rough guideline to using it.
  442.  
  443. vi has three modes that you might be in.  For lack of some wierd-ass
  444. UNIX abbreviations for them, I've made my own names for them.  You start
  445. out in VISUAL editor mode, and can go to INSERT mode or COMMAND mode.
  446.  
  447. If you "vi newfile" or some unexisting file, you will see a bunch of
  448. tildes down the left hand side of the screen and that is it.  to
  449. actually start typing (ie to move from VISUAL mode to INSERT mode), you
  450. must choose the insert command, or "i".  You can also choose "a" which
  451. does the same thing, but moves you ONE CHARACTER right before adding
  452. text.  You can't move further left than where you started either (to,
  453. for example, correct a mistake you just noticed earlier in the line).
  454.  
  455. However, once in INSERT mode you can just type normally.  When you want
  456. to move around, or do some editing, or something, you'll want to move
  457. back to VISUAL mode.  Do this by hitting [ESC].  Now, you can move
  458. around with the movement keys:
  459. j = one char left, k = one char right, k = one char up, l = one char down.
  460.  
  461. Or, you can delete a character in front of the current cursor position:
  462. x = delete one character
  463. dd = delete entire line (analagous to Ctrl-Y in wordstar)
  464.  
  465. You can also move up a page:
  466. b = go back one page
  467. n = go to next page
  468. g = go to start of docuemnt
  469. G = go to end of document
  470.  
  471. You can also repeat commands by typing a number first.  So for example,
  472. typing 10dd will delete the next 10 lines.  typing 50j will move left
  473. fifty characters.
  474.  
  475. Once you have everything edited and looking good, you'll want to save.
  476. Go to COMMAND mode by hitting Q (must be upper case) from VISUAL mode
  477. (and you will have to do [ESC]Q from INSERT mode).
  478.  
  479. You will see a prompt (a colon) pop up at the bottom of the screen and
  480. the cursor will go there. At this point you are basically in ed(1)
  481. again.  You can use the "w" command to write the file, then the "q" to
  482. quit... or you can quit without changing by doing a "quit!" (it forces
  483. you to do this if you haven't saved).  If you messed up and want to go
  484. back to VISUAL mode from command mode, just enter the command "vi".
  485. Many other commands are available but those are enough to get you by
  486. on a day to day basis.  With vi, practice definitely makes perfect.
  487.  
  488. There is also a quicker way to get to command mode, but it returns you 
  489. right back into visual mode when you have entered each command.  From 
  490. visual mode, just type a colon ":" and the colon will appear, then type 
  491. the command and ENTER.  Once it has executed you are back in visual 
  492. mode.  This is faster in a lot of cases.
  493.  
  494. There is one more ESSENTIAL command for happy vi'ing.  It's the undo
  495. command, "u".  You can use the "u" command from VISUAL mode any time
  496. you like to undo the last editing action.  Using it a second time will
  497. re-do the last edit action.
  498.  
  499. 2.4    Intra-system communication
  500. ----------------------------------
  501.  
  502. UNIX is designed as a multi-user operating system.  Thus the chances of only
  503. one person being logged on the system at the same time are quite slim; in
  504. large mainframes there are often well over 20 people logged in at once, even
  505. during off hours.   UNIX allows you, using a number of built-in functions, to
  506. communicate with and annoy these people freely.  This is extremely useful for
  507. getting information in a hurry.  Coffee Talk thrives under UNIX.
  508.  
  509. *Command: who
  510. The who command will tell you who is logged into the system.  You are given
  511. two fields of information about each user.  Their login id is shown, and the
  512. port that they are logged in from (called a tty - usually of the form ttyxx
  513. where xx can be any combination of letters and numbers).  Try this command
  514. now.  Usually there will be an operator logged in always, regardless of who
  515. is on the system - this is just an account that stays open all the time and
  516. should cause you no sudden paranoia.
  517.  
  518. The next thing we will want to do is commuinicate with these people.  If
  519. there's someone you know (or you can even do this to yourself, it will work
  520. fine) then write them a note:
  521.  
  522. *Command: write
  523. At your shell prompt, use 'write [userid]' to write another user.  They will
  524. hear a beep, and on their screen they will see:
  525.  
  526. MESSAGE FROM yourid ON TTYxx
  527.  
  528. Followed by each line of text you type, as soon as you finish typing it.
  529. When you've finished your message, you can hit CTRL-D to finish - the person
  530. you were writing to will see 'EOF' on their screen.
  531.  
  532. You can also pipe and redirect things into the input of a write function -
  533. thus you can type a notice and:
  534.  
  535. write auser <notice.txt
  536.  
  537. I have a program called banner which just makes a large banner of the argument
  538. (in big friendly letters).  I often greet people with this command:
  539.  
  540. banner Good Morning! | write auser
  541.  
  542. If a user is logged on more than once, you will see a message:
  543.  
  544. User auser logged on more than once - writing to ttyxx
  545.  
  546. If for some reason they aren't responding you can try another tty - simply
  547. add which tty you want to write to after the command (don't include the
  548. 'tty').  For example, to write to user jblow on ttyie:
  549.  
  550. write jblow ttyie
  551.  
  552. Sometimes write will tell you:
  553.  
  554. Cannot write to ttyxx - Permission denied.
  555.  
  556. This means that the person has turned off their messages and obviously
  557. doesn't want to be disturbed by people writing them.
  558.  
  559. *Commmand: mesg
  560. mesg controls whether your messages are on or off.  The default is to have
  561. them on so that people can write you; you can turn them off however by
  562. issuing the command:
  563.  
  564. mesg n
  565.  
  566. Or turn them on using
  567.  
  568. mesg y
  569.  
  570. Typing 'mesg' with no aruments will tell you what the current setting is.
  571.  
  572. You can find out whether a person's messages are on or off, and a lot more
  573. useful information by using the finger command.
  574.  
  575. *Command: finger
  576. finger is one of the most useful UNIX commands you will encounter.  Sometimes
  577. versions of finger vary depending on your system; but on most new System V
  578. and BSD UNIX systems the format is exactly the same.  Finger is like an
  579. extended who, which also allows you to get specific information on a user.
  580.  
  581. for example, you could type
  582.  
  583. finger jblow
  584.  
  585. and get the following:
  586. [blah blah blah]
  587.  
  588. You are given the user's login id, message status (if messages are off you
  589. are told so), time of login, idle time (time since user last entered a
  590. command), when the mail was last read, the contents of the user's ~/.plan
  591. and ~/.project files, and the user's full name.
  592.  
  593. The .project and .plan information is specified by creating files in your
  594. home directory named .project and .plan respectively.  Note that only the
  595. first line of the .project file is shown.  Some serious anal-retentive people
  596. use this for its intended purpose, but most people put a friendly or silly
  597. greeting in there (really dumb people provide you with their home address
  598. and telephone number... heh heh heh).
  599.  
  600. Whoever set up your account most likely entered your full name in the "In
  601. real life:" field - you can in fact change this to whatever you like using
  602. chfn.
  603.  
  604. *Command: chfn
  605. chfn (for CHange Full Name), allows you to change the contents of the "In real
  606. life" field when someone fingers you.  Just enter 'chfn' at the prompt and
  607. you will be asked for a new full name - as your last name is given by your
  608. id in most cases, lots of people stick their first name in here (It's not
  609. kosher to call yourself Adolf Hitler on UNIX systems, by the way).
  610.  
  611. *Command: talk
  612. When you tire of the akwardness of the write command, you might want to try
  613. the talk command.  This bascially allows you to chat to another user in a
  614. nice split-screen chat mode; your typing goes on one half of the screen and
  615. the person's that you're talking to goes on the other.  Talk is much more
  616. sophisticated too in that it gently pages the user without just barging in on
  617. their screen.  Attempt to talk to someone else by typing:
  618.  
  619. talk userid
  620.  
  621. And they will hear a beep and see this message:
  622.  
  623. You are being paged by jblow@machine.address.address
  624. To respond type talk jblow@machine.address.address
  625.  
  626. Don't worry about the @ sign or the address information for now - I'll
  627. explain that in the next section.  You can actually reply to someone on your
  628. own system just by typing the userid - (you don't need the @ sign or the
  629. address).
  630.  
  631. While this is going on, the person who initiated the page is waiting in a
  632. blank talk screen and getting a status report on how the paging is going.
  633. When the person finally responds the top status line will say
  634.  
  635. [Connection Established]
  636.  
  637. and you can begin typing.  To stop talking use Ctrl-C to exit.
  638.  
  639. If you are talking to someone on your machine and they are logged in
  640. more than once you can pick the tty to talk to (just like with write).
  641. but this time, you use just the two letters at the end:
  642.  
  643. talk jblow i5
  644.  
  645. will talk to jblow on ttyi5.
  646.  
  647. *Command: mail
  648. Using the mail command, you can send electronic mail to any user of the
  649. system, and you can read any mail that you have waiting in your own mailbox.
  650. Most sytems will notify you if you have mail when you log in.  To check your
  651. mail box type:
  652.  
  653. mail
  654.  
  655. If there is no mail for you you will be told so, otherwise the list of
  656. subject lines, or headers, will appear on the screen.  Each message header
  657. has a number and tells you who it's from, as well as the subject.  You can
  658. then hit <enter> to start reading at the first message.
  659. Like ed, mail has the concept of a current message - you can use any of the
  660. mail editing commands and they will effect the current message, or you can
  661. specify which message you want them to work on.  The commands are:
  662.  
  663. h         - Redisplay the list of headers
  664. d<#>         - Delete message
  665. r<#>         - reply to message
  666. s<#> <filename> - save message (it will save it to a file called mbox unless you type a
  667.                   filename using 's filename')
  668. q         - quit and append all undeleted messages to the ~/mbox file
  669. x         - exit, leaving the messages pending in your incoming mailbox.
  670.  
  671. the mbox file is a file in your home directory where any mail that you don't
  672. delete is kept.  You can go through and edit or delete this as you please;
  673. it's a convenient place for storing mailings you want to keep for a while.
  674.  
  675. To mail another user, type:
  676.  
  677. mail userid
  678.  
  679. You will be prompted for a subject (which the other user will see in their
  680. headers when they type mail).  Then you are free to type whatever you want in
  681. the mailing and end it with a CTRL-D character.
  682.  
  683. If you mess up their userid the mail will eventually get returned to you and
  684. you can save it in mbox or somewhere else, edit it and then try again.  In
  685. chapter 4, I'll explain how to mail someone anywhere in the world, assuming
  686. you know their address.
  687.  
  688. If you are lucky, there is a program called "elm" on your system.  elm
  689. is a much more advanced mailing system then the default mail(1), and
  690. allows you to quote in your replies and use vi to write them etc.  Find
  691. out by just typing "elm" (it will be in the path if it's there) or if
  692. you suspect it's around but not in the path then talk to the
  693. administration on your system and bug them about it.
  694.  
  695.  
  696. 2.5 Multitasking without L.S.D.
  697. -------------------------------
  698.  
  699. Multitasking on UNIX is extremely useful and very easy to do.  Each 'thing'
  700. you have running on the system is called a process or job.  The shell which
  701. you use to enter commands is a job which is always running; when it ends
  702. you are logged out of the system.
  703.  
  704. *Command: jobs
  705. To find out what jobs you have running, type the command:
  706.  
  707. jobs
  708.  
  709. from the shell.  A list of all jobs currently running (each one with its own
  710. number) is shown.  Initially all you will see is your shell.
  711.  
  712. You get out of a job and back to the shell (where you can start new jobs) by
  713. using the CTRL-Z hotkey.  When you CTRL-Z a process its exectution is
  714. suspended, and UNIX issues the message
  715.  
  716. Stopped
  717. %
  718.  
  719. and you are returned to the command prompt.  Try this - look up something in
  720. the manual by typing:
  721.  
  722. man talk
  723.  
  724. and wait until the screen appears, then hit CTRL-Z.  You will be returned to
  725. the shell. Typing 'jobs' shows you that, sure enough, process number two is
  726. man talk, and that the job is currently stopped.  There will also be a '+'
  727. symbox next to it, meaning simply that this is the CURRENT job.  The csh job
  728. will most likely have a '-' symbol next to it, indicating that it is the
  729. PREVIOUS job.
  730.  
  731. You control which job you're seeing on the screen using the fg command.
  732.  
  733. *Command: fg
  734. fg will put a specified job in the foreground.  To put the job listed as
  735. CURRENT (+) in jobs into the foreground, type fg %.  The job resumes
  736. execution from where you stopped it.  To put a specific job in the foreground
  737. by number, use fg %n where n is the number of the job.
  738.  
  739. You can also keep processes running in the background while you do ohter
  740. things - this is achieved using the bg command.
  741.  
  742. *Command: bg
  743. bg will place a specified job (use %n or %) into the background and continue
  744. its execution.  Note that if this job decides it's going to output to the
  745. screen it will display right over whatever you are doing in the foreground.
  746. You can avoid this by redirecting the output using > when you start the
  747. process. This can be very chicken-and-egg if you don't know that you're going
  748. to stick it in the background when you start though; most times it's not
  749. really worth the hassle.
  750.  
  751. When a process finishes execution and exits while still in the background you
  752. will be notified by UNIX that it has finished.
  753.  
  754. *Command: &
  755. Using an ampersand '&' after a command line will automatically put that job
  756. in the background.  So, for example, you could type:
  757.  
  758. crack /etc/passwd >validfile &
  759.  
  760. and that process would begin running in the background, piping its output to
  761. validfile and allowing you to go on and play with other things.
  762.  
  763. *Command: ps
  764. ps, another wizard abbreviation for ProceSs will give you the processes (née
  765. jobs) that you have running on the system (even ones you started from a 
  766. different terminal when you're logged on more than once).  You are given four
  767. columns of information, left to right.  These are the pid, the tty it was
  768. started from, the CPU time it has used to far, and what the process is.
  769.  
  770. You can be nosy and see ALL the processes running on the system if you like.
  771. This lets you know what other people are doing, and you can even find out
  772. some interesting information from doing this sometimes.  Use the -a switch.
  773. If you see something that interests you and you want to see who is running it
  774. you can easily find out using 'who' - just match up the tty.  Alternatively,
  775. you can get sophisticated and use grep.  For example:
  776.  
  777. who | grep ttyie
  778.  
  779. will tell you who is on ttyie. Or you could
  780.  
  781. ps -a | grep talk
  782.  
  783. to find out which tty's are using the talk command right now.
  784.  
  785. ps displays information for active (doing something) processes only.  To see
  786. a list of inactive (stopped) processes that you have, use the -x switch.
  787. This is useful for when your terminal freezes and you get stuck on the
  788. system.  Sometimes even dropping carrier on a modem won't terimate the
  789. session.  To do this properly, or to kill a process you don't want quickly,
  790. use the kill command (you have to log in from a different tty to do this.)
  791.  
  792. *Command: w
  793. w is a much eaiser way than using the "ps -a | grep" combination of
  794. finding out what people are doing.  typing "w" by itself tells you all
  795. the userids on the system and what they are up to.  You can also
  796.  
  797. w jblow
  798.  
  799. to see what he is up to.  The only setback with w is that it only shows
  800. the top command that a user is doing.  So for instance, you can hide
  801. what you are doing from a "w" by doing something like this:
  802.  
  803. write root <fuckyoufile& ; rn
  804.  
  805. and w would only show you as using "rn".  This doesn't make the above
  806. method safe at all, by the way, for hiding what you are doing - try it 
  807. sometime by putting lots of commands going and then doing a "ps -a".
  808. It's a hurrendously bad idea.
  809.  
  810. *Command: kill
  811. The easiest way to use "kill" is to list your jobs with the "jobs"
  812. command, and then kill the one you want by typing, for example,
  813.  
  814.      % kill %3
  815.  
  816. to kill job 3.  Sometimes you need to kill a defunct login shell or
  817. something else you have started that isn't listed in the "jobs" listing.
  818. In this case, type "ps" to see the process listing for your login, and
  819. if that STILL doesn't have what you want to kill, the process you're
  820. looking for is idle or defunct.  Type "ps -x" to show ALL processes,
  821. even those inactive ones you've started.  Write down the pid you want.
  822. Then:
  823.  
  824. kill [pid] will kill the process with the specified pid.  If you are trying
  825. to kill an incative process, use the -9 switch as well:
  826.  
  827. kill -9 12746
  828.  
  829. will kill the inactive process with pid 12746.
  830.  
  831. If you're killing an inactive shell (ie. a stuck shell) make sure you don't
  832. mess up and kill the current one - that will just log you out.  You can usually
  833. tell the difference by looking at the pid's - pids are simply handed out in
  834. order and so the shell with the closest pid to the ps -a command is the one 
  835. that you're currently using; kill the other one.  (One of these kids is not 
  836. like the other one/ one of these kids is doing his own thing...)
  837.  
  838. 2.6 Security - file permissions and chmod
  839. -----------------------------------------
  840.  
  841. Every file in the UNIX operating system has privelages associated with it.
  842. These are grouped into three categories:  owner, group, and all.  You can set
  843. the access on a file to different levels for each of these.  When you do an
  844. 'ls -l' command, you are given the access privelages of each file.  Here's
  845. what the fields mean:
  846.  
  847. drwxrwxrwx filename ...
  848. ^^^^^^^^^^
  849. ||||||||||------ Execute by all (if a directory, execute controls "cd" access)
  850. |||||||||------- Write (alter) by all (or write into a directory)
  851. ||||||||-------- Read by all
  852. |||||||--------- Execute by group
  853. ||||||---------- Write by group
  854. |||||----------- Read by group
  855. ||||------------ Execute by owner
  856. |||------------- Write by owner
  857. ||-------------- Read by owner
  858. |--------------- File is a directory
  859.  
  860. When you see these letters it means that the attribute is set (ie. the access
  861. is available).  When these attirbutes are cleared, a dash (-) appears in
  862. their place.  For example, You might set a private text file to read and
  863. write by owner only, and no other permissions.  Its ls -l attributes would
  864. look like:
  865.  
  866. -rw------- filename
  867.  
  868. Or you might give read and execute access to everyone, and read, write, and
  869. execute access to yourself:
  870.  
  871. -rwxr-xr-x filename
  872.  
  873. And so on.
  874.  
  875. You actually set these parameters using the chmod command.
  876.  
  877. *Command: chmod
  878. The syntax of the chmod command is as follows:
  879.  
  880. chmod xxx filename
  881.  
  882. Where xxx is a three digit number describing the files permissions.  The
  883. first column of the number represents owner permisssions, the second group
  884. permissions, and the third 'all' permissions.  You get the digit to place in
  885. each by adding the attributes you want:
  886. 1 - execute
  887. 2 - read
  888. 4 - write
  889.  
  890. Examples are the easiest way to illustrate this concept:
  891.  
  892. chmod 600 myfile will make the file read and write only, for the owner only.
  893. -rw------- myfile
  894.  
  895. chmod 777 afile will make the file read, write, and execute for all users:
  896. -rwxrwxrwx afile
  897.  
  898. chmod 733 thefile will give the situation above, where all users can read and
  899. execute, but only you can write:
  900. -rwxr-xr-x thefile
  901.  
  902. Understanding chmod is quite important if you want to be able to keep your
  903. Stuff secure.  You can do away with the worry by just chmod 700'ing your home
  904. directory and then ignoring it forever more; this way no one can get in there
  905. to look around (although you will want to chmod 700 any subdirectories you
  906. make as well).
  907.  
  908. And so there you have it; the compelte ten minute guide to UNIX.  With the
  909. information in this chapter you're quite able to start playing around and
  910. exploring your system.  The next chapter goes into some more advanced things
  911. you can do locally, including attempting to find youself another account to
  912. work from if you are going to be doing anything you shouldn't.
  913.  
  914.  
  915.                ////////////////////////////////////////
  916.               // 3.0 Playtime on your local system. //
  917.              ////////////////////////////////////////
  918.  
  919. 3.1 Aliasing Commands
  920. ---------------------
  921.  
  922. By now you are probably already pissed off with some stupid UNIX
  923. commands, thinking "that could be a lot shorter if I could just type
  924. THIS..." or "I can't type and hate typing THAT...".
  925.  
  926. UNIX has an extra-funky command called "alias".  You may have seen this
  927. concept before as a lot of people loved it and snagged it right away.
  928. Anyways, here's some examples right off the bat:
  929.  
  930. alias fall finger rnixon llong root admin@csoffice
  931.  
  932. would make a command called "fall" that would do all that; a quick way
  933. to finger all the people you're interested in.
  934.  
  935. alias copy cp
  936.  
  937. will make every occurence of "copy" mean "cp".  You can effectively
  938. alias UNIX to be the same as DOS.  (Why you'd want to is utterly beyond
  939. me.)
  940.  
  941. alias fp setenv FSP_PORT
  942.  
  943. in FSP (covered later) you sometimes have to issue a command like this:
  944.  
  945. setenv FSP_PORT 6667
  946.  
  947. After the 20th time this gets annoying.  So this is an example of how to
  948. use alias to abbreviate commonly used commands.  After that other alias
  949. you just type
  950.  
  951. fp 6667
  952.  
  953. to accomplish the same thing.
  954.  
  955. Typing alias with no arguments gives a list of your current aliases.
  956. You can remove one of them by typing "unalias fp" or whatever it is you
  957. want to unalias.
  958.  
  959. One more note - when you logout your aliases are lost.  To keep them
  960. permanently, use vi to add them to your .cshrc file.... (the .cshrc is
  961. preferred to teh .login as the .login should not contain any c-shell
  962. commands (alias is one)).  An EXCELLENT few aliases to add to your
  963. .cshrc are the following:
  964.  
  965.      alias rm rm -i
  966.      alias mv mv -i
  967.      alias cp cp -i
  968.      alias ls ls -F
  969.  
  970. These make UNIX ask you before it deletes or overwrites a file (there's
  971. no undelete whatsoever, so this is a good idea), and shows directories
  972. in "ls" listings with a trailing slash.
  973.  
  974.  
  975. 3.2 Shell Scripts (inc. ~/.*)
  976. -----------------------------
  977.  
  978. Shell scripts in UNIX accomplish the same thing as batch files in DOS.
  979. They can be a lot more advanced with that; the UNIX shell is actually a
  980. very powerful programming language with just about every feature you
  981. would want in most cases... however, for most users you very rarely even
  982. look at shell scripts.
  983.  
  984. The much-mentioned .login and .cshrc and .logout files are all shell
  985. scripts that reside in your home directory.   When you log on, the
  986. system just runs them.  They are the same thing as AUTOEXEC.BAT in DOS,
  987. really.
  988.  
  989. To run a script you have prepared yourself, or to just run one of your
  990. login scripts or whatever, you type
  991.  
  992. source script
  993.  
  994. where script is the name of the script you want to run.  You CAN make
  995. scripts that are run by just typing their name; to do so you must make
  996. them executable using chmod.
  997.  
  998. What about arguments to scripts?  You may well want to write a quick
  999. script that will make it quick to do a task.
  1000. In DOS, to refer to the first argument in a batch file you use
  1001. %1.  Or to refer to the second it's %2.  UNIX is the same, with a dollar
  1002. sign:  $1 is the first argument, $2 the second, etc.  Also, $0 returns
  1003. the number of arguments that were passed.
  1004.  
  1005. Lots of good books on shell programming are available (usually cheap--
  1006. who the hell wants to learn about SHELL PROGRAMMING anyways?) if you
  1007. want to go gung ho in this area.  It can really pay off if you use UNIX
  1008. a lot.
  1009.  
  1010. 3.3 Changing your default shell, and the tcsh shell
  1011. ---------------------------------------------------
  1012.  
  1013. Sometimes you will want to change your default shell... usually if you
  1014. are moving up to a newer one or some wierd client program or something.
  1015. The command for this is "chsh", but you need to know the full path of
  1016. the shell you are changing to.  The best way to do this is to finger
  1017. someone else who is using it; the full pathname is shown in that
  1018. information.
  1019.  
  1020. If you have the tcsh available on your system, I'd definitely recommend
  1021. using it, for two main reasons:  Command line editing and filename
  1022. completion.
  1023.  
  1024. What and what?
  1025.  
  1026. In tcsh you can go back to your last command just by hitting the up
  1027. arrow.  You can move around in them using left and right arrows and edit
  1028. them.   This is referred to as Command Line Editing.
  1029.  
  1030. Too lazy to type the name of "this.is.a.long.bloody.file^Lwith.wierd.
  1031. control.^G^Gcharacters.in.it" every time you want to cat the damn thing?
  1032. In tcsh just type the first few letters and hit TAB - it will complete
  1033. the filename.  If that's not the right one (ie you did not enter a
  1034. unique pattern) then hit TAB again until it's right.
  1035. A trailing slash character ("/") will let you know it is filename
  1036. completing - this will not effect the command so don't try to get rid of
  1037. it and get yourself a nice headache...
  1038.  
  1039. 3.4 Causing mindless havoc through write and other childish tricks
  1040. ------------------------------------------------------------------
  1041.  
  1042. Really want to annoy someone?  Just write them the (usually several
  1043. megabytes) /var/adm/lastlog file.
  1044.  
  1045. There are ENDLESS childish tricks that work great on a UNIX system to
  1046. annoy people.  I don't really have time to delve into any of them,
  1047. rather I included this section to let you know that they exist.  So if
  1048. someone flames you or annoys you, worry not; revenge is just a few
  1049. keystrokes away.
  1050.  
  1051. Some thing to experiment with are the "batch" and "at" commands - they
  1052. let you do things when you aren't logged in (and wreak all sorts of
  1053. havoc).  But beware -- all of this activity is logged.
  1054.  
  1055. You may, in your exploring, come across how to use the "su" command to
  1056. switch between accounts with the same password.  EVERY su USE IS LOGGED!
  1057. I just included this as I know someone who nearly got himself in a lot
  1058. of trouble by su'ing between two accounts and not realising that it was
  1059. logged every time.  This is a good lesson - when you ARE breaking the
  1060. rules, especially if you are causing havoc, make damn sure you're not
  1061. getting entries with your id in the user logs (look in the /var/adm
  1062. directory for these and grep them frequently).
  1063.  
  1064. I will include my favourite trick here, as it's just so damn funny.  
  1065. Find someone logged onto an account which you have access to.  Then log 
  1066. quietly in as that account, and "w" them, finding out which tty they are 
  1067. on.  Suppose for the sake of argument they are on ttyi5.  Because you 
  1068. are logged in as that person, you have write access to their /dev/ttyi5 
  1069. file. This file controls all the output that appears on their terminal - 
  1070. programs just append directly to it and that appears on their screen.  
  1071. Imagine the possibilities!  The next thing to do is make up a fake 
  1072. message using cat:
  1073.  
  1074. %cat >fakemsg
  1075. ^G^GMessage from root on ttya0 at 08:23
  1076.  
  1077. You have been found in violation of system security!  Your telephone
  1078. number has been logged and the police will arrive shortly.  Do not 
  1079. attempt to escape.
  1080.  
  1081. EOF
  1082. ^D
  1083. %cat fakemsg >>/dev/ttyi5
  1084. %rm fakemsg
  1085.  
  1086. See what this does?  As far as they know, they are receiving a genuine 
  1087. write (as it couldn't be from anyone else, could it? 8).  There are lots 
  1088. of fun things to do along these lines.
  1089.  
  1090. 3.5 The importance of being Earnest (hiding what you are doing)
  1091. ---------------------------------------------------------------
  1092.  
  1093. One of the double-edged blades of UNIX is that everyone can see what
  1094. everyone else is doing.  This is great if you're snooping someone else
  1095. but awful if you are trying to hide what you are doing.  Fear not,
  1096. however, with a couple very simple tricks, you can hide virtually
  1097. ANYTHING you are doing.
  1098.  
  1099. The logical idea is to make it look like you are running something
  1100. benign.  For example, I use an Internet-Relay-Chat client that I have
  1101. compiled on my system.  As the administration there is
  1102. super-anal-retentive, I doubt they'd approve.  So instead of having
  1103. "irc" on my process list, I have "rn".  How?  Easy - I just rename the
  1104. irc command to "rn" with a "mv".
  1105.  
  1106. But that by itself doesn't work - you try it, type rn and will find
  1107. yourself in the news reader.  (this is intentional I think).
  1108.  
  1109. The reason for this lies in how UNIX finds commnands and puts them onto
  1110. the process list.  Every time you run a command, whatever you typed is
  1111. added with various other information to the process list to be run by
  1112. the system.  While it is executing others can peek and see what you are
  1113. doing with a "w" or "ps -a" command.  You can hide from "w"'s by putting
  1114. a benign command on the end and using a semicolon (as I described
  1115. earlier) but I would discourage this as soon someone will come along who
  1116. is not brain dead and will catch you.
  1117.  
  1118. UNIX finds commands (like DOS) by following the PATH variable, which is
  1119. defined at startup time in your .login or .cshrc (usually this one)
  1120. script.  The reason I am mentioning this at all is this:
  1121. UNIX will NOT look in the current directory first then hunt the path; it
  1122. follows the path directly.  If you look in your .cshrc, you will most
  1123. likely find the path statement, looking something like this:
  1124.  
  1125. set PATH=( /usr/yourid/bin /bin /usr/ucb/bin [etc etc etc] . )
  1126.  
  1127. Note the period at the end.  This means your current directory is
  1128. searched LAST.  In order to fake commands, you need to move this period
  1129. to the front of the path statement (use vi) so that commands in the
  1130. current directory are executed FIRST.
  1131. Your new path would be
  1132.  
  1133. set PATH=( . /usr/yourid/bin /bin /usr/ucb/bin [etc etc etc] )
  1134.  
  1135. Now, you can execute commands you have renamed and have them run.  It
  1136. was of course possible before by typing "./rn", but then that shows up
  1137. on the process list and anyone with any UNIX-know-how will realise you
  1138. are doing a lousy job of faking the command; your downfall will be
  1139. swift.
  1140.  
  1141. Once you have fixed your path then you can safely make all sorts of
  1142. renamed commands.  I even rename my telnet command so no one knows I'm
  1143. even logged onto another system (again, the admin at my location is very
  1144. anal about telnet use, so I just hide it).
  1145.  
  1146. This procedure is basically foolproof, unless someone finds this "rn"
  1147. program of yours.  The best strategy at this point is to give up
  1148. sheepishly.  Thus it's a good idea to delete it every time and remake it
  1149. when you need it.  This is hard for a client or something but easy if
  1150. you are just stealing a system command like telnet.
  1151.  
  1152. A note on symbolic links - you may have someone reveal to you another 
  1153. method, called "symbolic linking".  In UNIX you can make a file "point" 
  1154. to another file.  For instance, you could do the following from your 
  1155. home directory:
  1156.  
  1157. %ln -s /usr/ucb/telnet rn
  1158.  
  1159. This would make a file as such:
  1160.  
  1161. lrwxrwxrwx 0 Blah blah rn -> /usr/ucb/telnet
  1162.  
  1163. Which (note the first "l" there) is a SYMBOLIC LINK to the 
  1164. /usr/ucb/telnet file.  Then when you type "rn", telnet would be run and 
  1165. "rn" would appear on your process-id line.  HOWEVER, if one is to do a 
  1166. "ps -x" it shows that you are really just using a symbolic link.  The 
  1167. administrators at your site no doubt know this so it's not an advisable 
  1168. method to use, even if it does save you the space of creating another 
  1169. copy of the program you are trying to hide (as symbolic links are 0 
  1170. bytes big).  If you are really pushed for space, use a directory off 
  1171. "/tmp" or something.  Be sure to chmod 700 it though or anyone could 
  1172. look in!
  1173.  
  1174. 3.6 cat /etc/passwd > ~/lab7.h
  1175. ------------------------------
  1176.  
  1177. What does that mean?  It's the quintisential idea around which password
  1178. snagging and UNIX account hacking is built.  The first time you try to
  1179. copy the /etc/passwd file to hack it, you will get a "permission
  1180. denied" message.  NO problem... on UNIX you must have read permission to
  1181. this (though I have seen systems where this ain't so, so you may well be
  1182. screwed either way) file.  You get a look at it by "cat"ing it and
  1183. piping the output to whatever file you like.
  1184.  
  1185. This is the first step in stealing passwords.  There is an art to doing
  1186. this.  I'll include a brief explanation of how and why this is done, the
  1187. rest is up to you.
  1188.  
  1189. UNIX is designed so that once your password is saved and encrypted, it
  1190. is IMPOSSIBLE to unencrypt it.  I mean this.  Not a fucking
  1191. chance-a-roo.
  1192.  
  1193. So what happens when you log in?  In the /etc/passwd file, UNIX stores a
  1194. des-encrypted version of your password that is not decryptable.  When
  1195. you type your password UNIX encrypts this version and compares the two
  1196. encrypted versions; if they match you got it right, otherwise you get a
  1197. "login incorrect".
  1198.  
  1199. The loophole is that this encryption method is readily available and
  1200. there is nothing to stop people like YOU snagging a copy of this file,
  1201. as described above, and monkey/teletyping every possible word into every
  1202. possible account until they are all matched up and cracked.  You use
  1203. common sense of course; running a dictionary file of 115000 words or so
  1204. into a normal passwd file will net you some accounts in under a minute
  1205. usually.  I (and I'm sure others too) have developed special methods for
  1206. cracking unused accounts on systems (nice as you can mail etc and relax
  1207. a bit).
  1208.  
  1209. Anyways, there are numerous and deservedly hard to get your hands on
  1210. programs to do this.  I stand religiously by Dr. Dissector's Killer
  1211. Crakcer (I use v9.11), but there are lots others.  KC is good as I have
  1212. an MS-DOS compiled one.  The big one used by system administrators to
  1213. catch stupid people and bitch them out for easy-to-crack passwords is
  1214. called (suprisingly enough) Crack.  The verison I have seen run is Crack
  1215. 4.1 but newer versions may be around.  I don't know of anyone who ever
  1216. got Crack to compile on a PC, but I do have a friend who made it work on
  1217. a couple of NeXT machines.  It flew.
  1218.  
  1219. If you are trying to crack a new system and are totally stuck for
  1220. passwords and a word file, just feed it the userids.  On any system I
  1221. guarantee at least two users are dumb enough to actually use their
  1222. userid for their password, thinking no one will ever guess that THEY
  1223. did.  They don't realise, obviously, that anyone can do what we're
  1224. discussing here and catch them real quick.  They're also so dumb I think
  1225. they deserve to have their accounts stolen.
  1226.  
  1227. So how to you avoid having someone hack your account?  Easy.  Because
  1228. people approaching this massive task are going to use dictionary files
  1229. and things like that, you can immediately make yourself safe by using
  1230. a nonsense word.  Spell it backwards.  Make it upper/lower case. Even
  1231. include control characters (^G's and ^L's etc) if you want.  With a tiny
  1232. bit of imagination you can make the task of cracking your account jump
  1233. from mildly difficult to absolutely fucking impossible.
  1234.  
  1235. 3.7 Security - a couple of cunning plans
  1236. ----------------------------------------
  1237.  
  1238. We've talked about hiding your password and what you are doing, but how
  1239. about hiding data?
  1240.  
  1241. UNIX has a built in DES standard encryption program called "des".
  1242. However, on some systems you may find the facist fuckers have removed it
  1243. so they can snoop better, and also if you are outside of the U.S.A. you
  1244. will not have des(1) available for legal reasons.  (I found it on my
  1245. Canadian system as "d" - they just hid it and moved it outta the path).
  1246.  
  1247. Anyways, des is so remarkably crackable it's not really worth the
  1248. effort.  It's much better, considering disk quotas etc) to use a
  1249. compression program to do the work for you, or, if you have it,
  1250. PGP to conventionally RSA encrypt it.  You can even write your OWN
  1251. scheme which will do it very well.  I wrote a program that just
  1252. scrambled the first 1K of a .ZOO file (I did it in FORTRAN!) and that
  1253. worked awesome.  NO one would EVER know what kind of a file it was, and
  1254. the ZOO's structure was all in the first 1K, and there is no zipfix
  1255. utility for a .ZOO archive.  You see?  Nearly all systems have a
  1256. version of arc (creates .ARC files compatible with PKARC and PKXARC)
  1257. available.  This works great - just use the g switch.  create a password
  1258. protected archive with
  1259.  
  1260. arc agpassword filespec
  1261.  
  1262. or unpack it with
  1263.  
  1264. arc egpassword name.arc
  1265.  
  1266. Easy stuff.  You can also get super-technical if you are very very very
  1267. worried.  The most elaborate scheme I ever came up with was to take .zoo
  1268. files, which keep all their file allocation information in the first 1k,
  1269. and then just use a random access FORTRAN thingy to encrypt teh first
  1270. 1k.  Then rename it to be a .tar file or .lzh or something to really
  1271. throw a wrench into the proverbial works.
  1272.  
  1273. Usually you don't need anything near this elaborate.  But renaming the
  1274. extension is super-handy for adding confusion.
  1275.  
  1276. What about mailbox security?
  1277.  
  1278. Currently, there is only one really good method of mailbox security, and 
  1279. for messages coming into you that aren't encrypted with it, you are SOL.
  1280.  
  1281. This is a genius piece of software named "PGP" for "Pretty Good 
  1282. Privacy".  It was written madly against new legislation in the U.S.A. 
  1283. which would have made ALL new encryption software have a 
  1284. government-accessable backdoor.  That means no more security for the 
  1285. common people.  However, PGP 1.0 was released just in time to beat this 
  1286. law, and then the authors had lots of time to improve it in the 2.x 
  1287. versions.  (As of this writing, the current version is 2.3A).
  1288.  
  1289. PGP uses an RSA encryption scheme, which is damn near impossible to 
  1290. crack, unlike the "goverment standard" DES algorithm, which is piss easy 
  1291. to crack by the government and other people with the computing power to 
  1292. waste.  At any rate, here's a brief yet confusing description of how PGP 
  1293. works, and an insight into its genius.
  1294.  
  1295. PGP uses what's called a keyring system.  This allows someone I've never 
  1296. met from across the world to send me private mail which only I can 
  1297. decrypt, although I've never even met her.  Similarly, I can be SURE 
  1298. that the mail has actually come from her and not from anyone else, 
  1299. having never met or talked to her either.
  1300.  
  1301. Each user has what is called a "public keyring" and a "private keyring".  
  1302. Your public key contains instructions on one-way RSA encrypting messages 
  1303. so that only YOU can decode them.  It's totally useless for 
  1304. decrypting messages.  Thus you make it readily available and lots of 
  1305. people take it and addit to their public keyring.  On your public 
  1306. keyring are the public keys of everyone you exchange mail with.  All of 
  1307. these are public knowledge and PGP is even clever enough to add keys 
  1308. automatically depending on how much you trust others on your keyring.
  1309. Your private keyring contains the key needed to decrypt the private mail 
  1310. to you.  This you take all pains to keep where no one can get their 
  1311. grubby hands on it.  Even if they do, however, they have to know your 
  1312. secret key phrase to unlock it, so you are really pretty safe keeping it 
  1313. on a big UNIX system.  The authors recommend keeping it only on your 
  1314. secure PC, however).
  1315.  
  1316. PGP is a truly excellent piece of software, and everyone should use it.  
  1317. You can find the latest version by ftping (see section 4.4 later) to
  1318. soda.berkeley.edu and looking in directory /pub/cypherpunks/pgp .
  1319.  
  1320.       /////////////////////////////////////////////////////////////////
  1321.      // 4.0 Reach out and touch someone - playing with the Internet //
  1322.     /////////////////////////////////////////////////////////////////
  1323.  
  1324. 4.1 finger, talk, and mail to remote clients
  1325. --------------------------------------------
  1326.  
  1327. The collection of computers (most are UNIX based) known as "the 
  1328. Internet" is the largest network in the world.  It was originally 
  1329. developed by the US Military as a network that would function after a 
  1330. nuclear strike; it's very decentralized so if part goes down the rest 
  1331. will survive.  However, this has led to its explosive growth to become 
  1332. the "cyberspace" of today.  The Internet is actually a collection of 
  1333. smaller networks - all sorts of things with names like BITNET, USENET, 
  1334. and many other animals.
  1335.  
  1336. From your internet account, you can receive mail from anyone else on the 
  1337. internet, anywhere in the world, for free, in a matter of minutes.  
  1338. Those who use email frequently refer to the old fashioned 
  1339. letter/envelope combination as "snail mail".  And indeed it is; if I 
  1340. mail someone in another country I'd be very irate to find out it took 
  1341. more than 1/2 hour for the mail to reach them through the Internet.
  1342.  
  1343. Just like in the real world, you have an "address" which people can use 
  1344. to send you mail, and to do other things (such as talk and finger you).
  1345. Your internet email address is totally unique - there is only one of you 
  1346. in the world.  Just like in the real world, sites are organized into 
  1347. countries, areas, etc.  The organization is logical rather than physical 
  1348. though, and may differ a bit.  Here is a typical email address of your 
  1349. typical San-Franciscan hipster cyberpunk white male:
  1350.  
  1351. bsmith@well.sf.us.com
  1352.  
  1353. Let's break this down into sections:
  1354.  
  1355. bsmith   @   well           .       sf         .    us    .    com
  1356.  
  1357. userid  at   machine name    sf=San Francisco      USA       "company"
  1358.  
  1359. When you are logged onto your machine, you will usually see its name 
  1360. before your prompt.  Were you on the Denver nyx sytsem you would see
  1361. nyx% before every command.  Unsurprisingly, nyx would be the "machine 
  1362. name" in the address.  There may be less or more fields in between the 
  1363. machine name and final "region" at the end of your address.  However, 
  1364. after a while you can quickly place an address in the world by its last 
  1365. region.  Here are some to watch out for:
  1366.  
  1367. .ca  - Canada
  1368. .edu - Educational institution (USA)
  1369. .com - Company (USA)
  1370. .uk  - United kingdom
  1371. .se  - Sweden
  1372. .fi  - Finland
  1373.   (etc)
  1374.  
  1375. You get the idea.  So, if you were to see the address:
  1376.  
  1377. cf123@cleveland.freenet.edu
  1378.  
  1379. and the Cleveland didn't give it away for you, you would definitely 
  1380. realise that you were talking to an educational institution in the USA 
  1381. from the .edu suffix.
  1382.  
  1383. Now we get to the actual meat of the discussion.  Let's say you want to 
  1384. mail your friend bsmith on the WELL system.  It's very easy to do:
  1385.  
  1386. % mail bsmith@well.sf.us.com
  1387.  
  1388. And then type your message.  In fact, you can finger him and even TALK 
  1389. him, right across the world, in the same manner.  It's just like on your 
  1390. local system:
  1391.  
  1392. % finger bsmith@well.sf.us.com
  1393.  
  1394. % talk rnixon@nyx.cs.du.edu
  1395.  
  1396. See?
  1397.  
  1398. Now one problem remains... short of mailing someone else to have them 
  1399. tell you, how do you figure out your own email address?
  1400.  
  1401. It's easy - just mail yourself on your system:
  1402.  
  1403. mail userid
  1404.  
  1405. and type a test message.  Then wait five seconds, check your mail, and 
  1406. write down the complete email address it gives you in the From: field.
  1407.  
  1408. One more aside on this subject.  Sometimes people who don't have ftp on
  1409. their system (the UNIX file transfer protocol program), mail files back
  1410. and forth through Email.  Because internet email is only 7 bits, there
  1411. is no way that you can send a regular binary 8-bit file through and get
  1412. a good copy out the other end.  There's a remedy for this, however:  the
  1413. UNIX uuencode and uudecode programs.  These basically take a binary file
  1414. and convert it to 7 bit.  It makes a huger file, but it will go through
  1415. email (and can be viewed with the unix "cat" or the dos "type") just
  1416. fine.  If someone sends you a uuencoded file, you need to save all the
  1417. messages (often it's broken into parts to overcome a message length
  1418. restriction) and then edit it.  Remove all the blank lines and
  1419. concatenate the pieces (this is where the ">>" pipe comes in really
  1420. handy... always keep copies of everything so you don't bugger up your
  1421. only copy!) and then type
  1422.  
  1423.    %  uudecode file1.uu
  1424.  
  1425. where file1.uu is your final encoded file.  If all goes well your binary
  1426. will just appear a second later.
  1427.  
  1428.  
  1429. 4.2 USEnet newsgroups
  1430. ---------------------
  1431.  
  1432. USEnet newsgroups are huge.  They are essentially just like FidoNet
  1433. newsgroups or any other newsgroups, but they are really really really
  1434. really really BIG.  Lots of people read them.  They are broken down into
  1435. two types; unmoderated and moderated.  In moderated newsgroups a
  1436. moderator must approve every post before it appears; unmoderated ones
  1437. operate on the anarchy principle.
  1438.  
  1439. Newgroups are named in a hierarchial way.  There are a number of
  1440. prefixes, such as
  1441.  
  1442. alt - "alternative" newsgroups, usually unmoderated.  Has wizzo groups
  1443.       like alt.sex.bondage.hamster.duct-tape
  1444. comp - Computer Science related newsgroups
  1445. rec  - "recreational" newsgroups.  These are more tame than the alt.
  1446.         groups.  Exmaples are rec.car.audo, rec.games.mud, rec.erotica.
  1447.  
  1448. You probably read newsgroups using the newsreader "rn".  Using rn
  1449. is pretty intuitive, so I'll let you struggle through it.  A hint
  1450. is to run it, and use "u" to get rid of newsgroups you hate, and
  1451. "g newsgroup" to change to and subscribe to a newsgroup.
  1452.  
  1453. hgwoeve,r you will probably find right away that you can't access a lot
  1454. of the groups.  Most places censor alt.* or at least alt.sex.* etc.
  1455. However, all is not lost, you can telnet to services like
  1456. nyx.cs.du.edu, or launchpad.unc.edu, or freenet-in-a.cwru.edu to get
  1457. full network news.  More on telnet in a second.
  1458.  
  1459. 4.3 telnet and rlogin
  1460. ---------------------
  1461.  
  1462. telnet and rlogin will become some of your most used commands.  they
  1463. allow you to log into another system, ANYWHERE IN THE WORLD, that is
  1464. connected to the internet.  It's free, it's easy, it's often very very
  1465. fast.
  1466.  
  1467. To telnet to another system, type "telnet system.address.domain.etc".  To
  1468. rlogin to a system, you type "rlogin system.address.domain.etc."'
  1469.  
  1470. The difference between the two is that rlogin will try to log you in as
  1471. the user, and has less options you can set than telnet.  In most cases
  1472. you will want to use telnet over rlogin; there are occasinal times that
  1473. you will use rlogin (see "man rhosts" if you are really curious), but
  1474. there is one very good advantage to telnet.
  1475.  
  1476. You can IMPLICITLY (ie. not on the command line) specify the host to
  1477. connect to with telnet.  Consider, if you had typed this:
  1478.  
  1479.      rlogin hacked.system.somewhere
  1480.  
  1481.           or even
  1482.  
  1483.      telnet hacked.system.somewhere.
  1484.  
  1485. Someone doing a "w" or "ps -a" would see you doing just that.  Then
  1486. they might get nosey and finger that system, and see that you're not
  1487. logged on as yourself any more (hence a stolen account.  Sound the
  1488. alarm!).
  1489.  
  1490. You can, however, type:
  1491.  
  1492. % telnet
  1493. telnet> open hacked.system.somewhere
  1494. Connected to some.system.somewhere
  1495. Escape character is ^]
  1496.  
  1497. Berkeley BSD 3.5 (hacked)
  1498. login:
  1499.  
  1500. --- you get the idea.  This way, all that shows up as a pid is "telnet".
  1501. You can further try to hide things by making a copy of the telnet
  1502. command (it's /usr/ucb/telnet) and calling it something else, like "rn".
  1503. (This can be better done with a symbolic link, try "man ln").  However,
  1504. don't think that this makes you safe.  TELNET IS STILL NOT TOTALLY SAFE.
  1505. Anyone who types "netstat" can see all the network connections
  1506. (including your telnet) to everywhere that are established.  With a
  1507. little deduction and work, a UNIX guru can find out who you are and
  1508. where you're telnetting to quite quickly.  There are other methods of
  1509. hiding yourself, but I'll leave those up to you to find out; we're
  1510. getting beyond the scope of this file already.
  1511.  
  1512. Anyways, one you connect a telnet session, hitting Ctrl-Z will send the
  1513. ^Z to the other computer.  So how do you put it in the background?
  1514.  
  1515. You put it in the background by typing the ESCAPE CHARACTER.  By default
  1516. this is ^] (control+right sq. bracket "]").  This can be changed to
  1517. anything you want by typing "set escape <char>" at the "telnet>" prompt
  1518. before you type "open".
  1519.  
  1520. When you type the escape character, it will put you back to the telnet>
  1521. prompt, and you can then ^Z.  Putting a telnet session in the background
  1522. doesn't do anything, as it just leaves it there waiting for you to type
  1523. something at the telnet> prompt.  However, while it's suspended, things
  1524. may be happening on the other system.  They will be kept in a buffer and
  1525. fly past when you reconnect.
  1526.  
  1527. To get back into a suspended session, type "fg %x" to get back into your
  1528. telnet.  YOu'll be back at the "telnet>" prompt.  Just hit Enter to go
  1529. back to the session you're in.
  1530.  
  1531. There is one other feature of telnet that is useful.  It lets you
  1532. connect to a specific PORT of a UNIX machine.  Usually, when you telnet
  1533. to a machine it has a default PORT setting that you get connected to.
  1534. You can imagine ports as different Big Grey Desks in the Deparment of
  1535. Motor Vehicles (...those of you who've been there know exactly what I
  1536. mean...).  When you just telnet, you get connected to the default, which
  1537. might be the "misinform you and just generally delay you" port.  But you
  1538. might want to specify the "new license and delay you" port, or the
  1539. "change your address and delay you" port.
  1540.  
  1541. You select a port by number and it will be given to you.  Some ports
  1542. have special values; for instance port 25 is how Internet mail works.
  1543. It's a very interesting one to play with (more on this later).  Port 112
  1544. is the news server.  These are never meant to be connected to by
  1545. people, but by programs called "Daemons" which do all the work at a low
  1546. level.  Anwyays, you will often find that online games, as well as
  1547. special sevices (like IRC, FSP, etc) require you to know the port
  1548. number.  You just add it after the address in your OPEN command, eg:
  1549.  
  1550. telnet> open louie.cc.utexas.edu 9999
  1551.  
  1552. will hopefully connect you to the Renegade Outpost MUD.
  1553. ---
  1554.  
  1555. If you _do_ use rlogin, and want to suspend your session, you'll notice
  1556. that ^] doesn't work.  YOu need to start on a new line, and type
  1557. ~^Z to suspend it.  If you see the "~" appear, then you weren't at a new
  1558. line; hit enter and try again.  (it shouldn't appear, and after you hit
  1559. the ^Z it will suspend the session.)  Just using "fg %x" will put you
  1560. right back in the thick of things.
  1561.  
  1562. One more tip before I leave these two; sometimes you will really want to
  1563. log a telnet session.  You do this with the "tee" command.
  1564.  
  1565. % telnet hacked.system.somewhere | tee hacked.log
  1566.  
  1567. The "tee" command will take the output from telnet, echo it to your
  1568. screen, and then write it to the file specified (hacked.log in this
  1569. case).  I'm not sure if you can implicitly telnet like this; try it out.
  1570.  
  1571. 4.4 FTP and FSP
  1572. ---------------
  1573.  
  1574. FTP and FSP are the way you transfer files from other systems.
  1575. Traditionally, you'd type "ftp system-name", and then log into the
  1576. system with a valid account, and then grab files from a directory.
  1577.  
  1578. However, there is another method of ftp available that everyone uses.
  1579. This is called "anonymous FTP".  This basically means you can ftp
  1580. somewhere, type in "anonymous" as the user name, send (theoretically)
  1581. your e-mail address for their files as your password, and it will let
  1582. you in.  there are many many many many files available through anonymous
  1583. FTP, and huge servers called "archie servers" (try telnet archie.unl.edu)
  1584. which just maintain anonymous FTP file lists throughout the internet.
  1585.  
  1586. Anyways, you start by connecting to a machine.  Always FTP implicitly
  1587. so you're not giving away where you're FTP'ing to:
  1588.  
  1589. % ftp
  1590. ftp> open ftp.netsys.com
  1591. 200 Connected to ftp.netsys.com
  1592. 200 Please login with your user-id and password
  1593. ...
  1594.  
  1595. it will then ask you your username. type "anonymous" (DON'T HIT ENTER or
  1596. they might log your username and it will be YOUR FAULT.  They DO Log
  1597. your machine, though they can't get your username if you anonymous FTP).
  1598.  
  1599. IT will say:
  1600.  
  1601. 220 Guest login OK.  Send complete e-mail address as password
  1602.  
  1603. Here, I always type something like "bsmith@my.machine.etc.etc".  This
  1604. way they won't necessarily suspect.  Don't be an idiot and type things
  1605. like "fuck you" here, as it shows up on the anonymous-ftp logs.  Most
  1606. pirate FTP sites don't even realise that they are being victimized.
  1607. It's shit like cowboys typing "fuck you" at the password prompt that
  1608. hint to them what's going on.  So keep it nice and incognito; lie, but
  1609. lie nicely.
  1610.  
  1611. Anwyays, as long as all goes well, you will be left at the
  1612. ftp> prompt.  Here, hitting ? brings up a list of commands.  The
  1613. important ones are:
  1614.  
  1615. binary - switch from ASCII to binary mode (ASCII is the default.
  1616.          You MUST do this before downloading a zip file or any
  1617.          8-bit (non text only) file.)
  1618. ascii - switch back to ASCII mode.  It's slightly faster for text files.
  1619. quit - close connection and quit.
  1620. ls  - get a UNIX ls listing.  swtiches (like ls -la) work fine.
  1621. dir - the same as "ls -la"
  1622. cd <dirname> - change to directory "dirname"
  1623. get <remote-file> [local-file] - get the remote-file (on that system)
  1624.                                  and call it local-file on your system.
  1625. eg:
  1626.  
  1627. ftp> get wing2-3.zip /tmp/mydir/hubble-3.gif
  1628. to download wing2-3.zip (you need to do a binary first, of course)
  1629. and put it in the directory /tmp/mydir, and name is as "hubble-3.gif".
  1630.  
  1631. or just
  1632.  
  1633. ftp> get filelist.txt
  1634. to get "filelist.txt" and put it in the current directory.
  1635.  
  1636. Similarly,
  1637. put <local-file> [remote-file]
  1638. works the same way. Again, Binary must be set to upload binary files.
  1639.  
  1640. There are also batch commands (mget and mput) you might experiment with.
  1641. They're all pretty intuitive.
  1642.  
  1643. You may have noticed this section is called "FTP and FSP".  Although
  1644. FTP is the primary method of acquiring files, FSP is starting to become
  1645. popular.  FSP is an internet file transfer protocol developed by Chuck
  1646. Forsberg and Omen Technology.  This is the guy who made Zmodem, so he
  1647. certainly knows his stuff.  Omen claims that FSP is much more efficient
  1648. than FTP; I haven't really noticed any astounding increase in
  1649. performance, but a lot of pirate/underground sites are FSP only so I've
  1650. included a quick section on it.
  1651.  
  1652. At the time of this writing, FSP is still relatively new.  Clients
  1653. (UNIX executables that you must download and compile; that's way beyond
  1654. the scope of this document... good luck) are now just starting to appear
  1655. that look the same as FTP and are as easy to use.  Just a short time
  1656. ago, the only way to FSP was to use "setenv" commands to set the port
  1657. etc. as part of your UNIX shell environment.  It was a real pain, and
  1658. you had to hack the code so that you could implicitly download.  (sigh).
  1659.  
  1660. Anwyays, by the time you read this, you can probably get a "Friendly"
  1661. FSP client anywhere.  (one may even be installed).  FSP addresses are
  1662. in the form of a site name/address and a port number:
  1663.  
  1664.      site.somewhere.etc 6667
  1665.  
  1666. You can open it just with
  1667.  
  1668. fsp> open site.somewhere.etc 6667
  1669.  
  1670. If you get stuck with one of the ugly "old" clients, you might have to
  1671. set these manually. Here are the ocmmands you'd type before running any
  1672. of your FSP programs (they'd be called things like fdir, fcd, fget,
  1673. fput, etc.)
  1674.  
  1675. % setenv FSP_PORT 6667
  1676. % setenv FSP_HOST site.somewhere.etc
  1677. % setenv FSP_DIR /
  1678.  
  1679. Hopefully you don't get nailed with one of these clients.  It's almost
  1680. worth downloading and going through the fun of compiling a newer one.
  1681. (you can always archie search for it).
  1682.  
  1683. Both the ftp and new fsp clients can be put in the backgound by
  1684. suspending them with ^Z and typing "bg".  They display a message when
  1685. the transfer is done.  If you keep doing ls -l's in the target
  1686. directory, you will see the size of the file grow.  Don't touch it until
  1687. the transfer is over or you will kill it!
  1688.  
  1689. You might encounter lots of files on public domain FTP and FSP sites
  1690. that end in .tar or .tar.Z or .tar.gz.
  1691.  
  1692. The .tar is a UNIX "tape-archive" file, like a zip with recursed
  1693. directories and no compression.  the .Z is the UNIX zcat compression
  1694. program, and the .gz stands for the UNIX gzip/gunzip compression
  1695. program.  (the .gz is to avoid confusion; if you get a gz file you MUST
  1696. rename it from filename.gz to filename.z before you gunzip it.
  1697. Originally it was just .z, but that got confused with .Z, so the files
  1698. are often saved as .gz.  Gunzip won't work with a .gz file though, it
  1699. looks specifically for the .z)
  1700.  
  1701. Anwyays, to uncompress a .Z file:
  1702.  
  1703. % uncompress <filename>[.Z]
  1704.  
  1705. To uncompress a .gz file:
  1706.  
  1707. % mv <filename>.gz *.z
  1708. % gunzip <filename>[.z]
  1709.  
  1710. To expand a UNIX tape archive:
  1711.  
  1712. % tar xvf <tarfile.tar>
  1713. (you need to tell it the .tar, it doesn't just assume it like the other
  1714. two.  Also a tar can be named something else totally, it needn't end in
  1715. .tar, but that's convention.)
  1716.  
  1717. 4.5 Gopher
  1718. ----------
  1719.  
  1720. Your system probably has a gopher client.  This you can run by
  1721. typing "gopher".  If you're too stupid to figure this out then you have
  1722. no hope with UNIX.  gopher is basically a moron-style menu driven
  1723. interface that flies around the internet and finds stuff for you.  YOu
  1724. can use a utility called "Veronica" to search the Internet for
  1725. information.  In a few seconds, through gopher, you could have the
  1726. complete works of Shakespeare at your fingertips, stocks, weather
  1727. reports, whatever the hell you feel like searching for.  It's a great
  1728. way to waste time.  Beware though; gopher makes readable temporary files
  1729. in your userid in the /tmp directory that people can see, so be careful
  1730. of what you're doing.  If you're definitely doing something you
  1731. shouldn't, type
  1732.  
  1733. % umask 022
  1734.  
  1735. first.  This will mean that no one can read any temporary files that are
  1736. created.  This may have already been done for you on your system.
  1737.  
  1738. 4.6 MUD, MUSH, MUCK, MUSE, IRC
  1739. ------------------------------
  1740.  
  1741. These are basically online games and chat services that you can find
  1742. over the Internet.  Some of you may (cringe here) have used STS (the
  1743. Synergy Teleconferencing System), or D-Dial systems, where someone buys
  1744. a bunch of phone lines, and lots of people with no lives all phone them
  1745. up and just chat to each other as a feeble substitue for social
  1746. interaction.  Some of you may have played those D&D type BBS's where you
  1747. can kill other people's characters.  These feeble modem type
  1748. implementations take on a much grander scale on the internet.
  1749.  
  1750. First, there is IRC:  Internet Relay Chat.  Rather than twelve
  1751. pimple-faced teenage males trying to seduce an 11-year old, you can talk
  1752. with any of thousands of online users from all over the world at any
  1753. time, on any of hundreds of channels.  You can even use DCC (Direct
  1754. Client Connect) to trade software over IRC etc.  To use IRC requires
  1755. setting up a client, which is pretty easy to compile.  Traditionally,
  1756. you are supposed to be able to "telnet bradenville.andrew.cmu.edu" and
  1757. get onto IRC, but it hasn't worked for me in about 2 years.  People
  1758. still insist that it works though.  Go figure.
  1759.  
  1760. MUD stands for Multi User Dungeon or Multi User Domain.  If you're going
  1761. to get addicted to any sort of stupid online game, this is the one for
  1762. you.  Picture one of those D&D BBS deals where it's like an infocom
  1763. adventure and you rush around killing things.  Now add a couple hundred
  1764. social commands so that with a little practice your character can
  1765. express any emotion, do anything you would do in a conversation through
  1766. commands (or even make up custom actions).  Now add 100 people all
  1767. logged in at once and interacting with each other, talking, relating,
  1768. making friends, and of course, grouping into paties and kicking the shit
  1769. out of countless monsters to raise through the hierarchy.  You have a
  1770. little bit of what MUD is like.  Be forewarned:  it is LETHALLY
  1771. addictive.  This is more or less cyberspace in a text implementation.
  1772. MUD is a _place_ that you explore and learn in.  The MUD I use is
  1773. Renegade Outpost.  It can usually be found at louie.cc.utexas.edu 9999,
  1774. daisy.cc.utexas.edu 9999, and will possibly move to
  1775. gpx.lis.uiuc.edu 4000.  MUD's are illegal in almost all situations where
  1776. you have an Internet account, so beware, and try to hide what you're
  1777. doing and do it at off hours or you will get caught.
  1778.  
  1779. MUSHes, MUCK's, MUSE's, etc are derivations on the same theme, more
  1780. geared towards social interaction.  There are some pretty sad people on
  1781. the internet; there are MUSH's where all you have in the universe is a
  1782. hotel lobby and rooms you can go to for net-sex with whoever you can
  1783. attempt to pick up (probably some large gay biker named Bubba from
  1784. the backwater district of Chicago, who calls himself "Alice").  These
  1785. are tiring and more or less a waste of time, unless you're really REALLY
  1786. desperate or something.  You will find you get sick in 10 seconds flat
  1787. of everyone wandering around looking like fucking venus incarnate.  It's
  1788. just too idealistic and pathetic for me.  MUSE's are a bit different
  1789. from MUCK's and MUSH's, as they are really a simulation environment.  A
  1790. lot of them are just more social drivel, but there are some really good
  1791. Battletech and Star Wars MUSE's etc.  MUD/etc lists can be found pretty
  1792. easily.  Try using "gopher" to search for them.
  1793.  
  1794.                    /////////////////////////////////
  1795.                   // 5.0 Piracy and the Internet //
  1796.                  /////////////////////////////////
  1797.  
  1798. 5.1 The Internet Pirate:  Scourge of the Network
  1799. ------------------------------------------------
  1800.  
  1801. I can't overstress how nice it is to pirate software through the
  1802. internet.  It can be safe, anonymous, and free if you do it properly.
  1803. It can also be VERY DANGEROUS if you fuck up.  You're meddling in a
  1804. worldwide network and all the straight people on it take piracy very
  1805. very VERY seriously.  It pisses them off.  Here's a few of the reasons
  1806. why:
  1807.  
  1808.      - They're advanced to an ethically higher ground, and much
  1809.        holier than thou.
  1810.  
  1811.      - They never learned to do it when they were young and they're
  1812.        bitter.
  1813.  
  1814.      - They just realised that pirates have been happily using their
  1815.        mainframe as a pirate anonymous-FTP site for three months,
  1816.        and they're really pissed.
  1817.  
  1818.      - They are Bill Gates.
  1819.  
  1820.      - They're one of the MANY MANY people who are BETTER THAN YOU
  1821.        and paid good money by large corporations to nail your ass.
  1822.  
  1823. The first and only rule for safe Internet Piracy is "suspect everyone".
  1824. You NEVER know who you're talking to.  Don't ever, EVER give out any
  1825. information unless you trust the person you're giving it to with your
  1826. future.  If it's a stolen account you're using then you're a little
  1827. safer, but if you can steal it, professionals can catch you stealing it.
  1828. There's always someone much better at UNIX than you (always) and they're
  1829. often against you.  Remember that and you should be fine.  More on do's
  1830. and don't's in section 5.4
  1831.  
  1832. 5.2 Getting Contacts
  1833. --------------------
  1834.  
  1835. The problem with Internet Piracy is that the sites are up and down
  1836. constantly.  In almost all cases, they are just simply stolen from a
  1837. system and announced.  For example, here's a typical scenario.
  1838.  
  1839. K-RadPir8 goes onto a University of Manitoba machine.  He finds that he
  1840. can make a directory on that machine (of course he can; it's for
  1841. anonymous ftp).  He goes and makes a very esoterically hidden directory
  1842. (with lots of non-printing and backspace characters in the name if he's
  1843. clever, but more often than not just something like ".. " (two dots and
  1844. a space) or ". unreadable  " (. unreadable is the message FTP displays
  1845. when it can't show you the contents of a dir... a good way of hiding a
  1846. site.  Sort of).
  1847.  
  1848. Anwyays, after making this directory, K-RadPir8 makes another three
  1849. underneath it, called ".bin", ".req", and ".tlk" or something to that
  1850. measure. They stand for binary files (wares), requests, and a dir to
  1851. just blab in.  How do you blab on an FTP site?  Well, the trick is to
  1852. just upload a very small (or 0 byte; see "man touch") file.  Then using
  1853. "put" you can give it a descriptive name:
  1854.  
  1855. ftp> put ~/nullfile "I want Wing Commander 2! - K-RadPir8"
  1856.  
  1857. The easiest way to delete these buggers when you're done is to use an
  1858. "mdel" command... I'd delete that above message with
  1859. ftp> mdel "I want*"
  1860. 200 mdel: Delete I want Wing Commander 2! - K-RadPir8 ...? YES
  1861. 200 mdel: Delete I want some new games - Some1ElSEkRad ...? NO
  1862. ftp>
  1863.  
  1864. You get the idea.  anyway, as you can see, it's quite hard to find the
  1865. damn things if you dont' know where to look.  There are a couple of
  1866. methods, both which take a little work.
  1867.  
  1868. The first one is to use archie.  You can set it searching for ".bin",
  1869. ".req", etc.  Or you can search for group names (likely to be in the
  1870. ZIP's of only pirate files), such as *INC*.ZIP, *TDT*.ZIP, etc.  (the
  1871. TDT in this case would be much better than the INC, as if you think of
  1872. it, lots of legitimate things might have the string "INC" in them, but
  1873. not very many of them will have the string "TDT" in them!)
  1874.  
  1875. If you suspect that a site has a pirate dir, or you know it does but
  1876. can't get into the dir beucase you can't figure out the name, don't
  1877. fret.
  1878. Just go the directory above the dir and type
  1879.  
  1880. ftp> dir . mydir
  1881.  
  1882. This does a dir of ".", the current directory, and puts it in the file
  1883. "mydir".  Now go back to UNIX and if you have a UNIX hex editor edit
  1884. mydir, or just send it to your PC and then edit it.  You can get the
  1885. ASCII codes of the characters in the directory name easily (spaces are
  1886. hex 20, a likely candidate) that way.
  1887.  
  1888. There is one other good method of getting sites and contacts.  On IRC
  1889. there is a special pirate channel.  It's called "#warez".  Once you find
  1890. a suitable IRC channel you can log to #warez by typing "/ch #warez".
  1891. Be SURE you are using a hacked account, or a hacked IRC client here.
  1892.  
  1893. I will only say this once.  It might cost you years in jail.
  1894.  
  1895.                *******************************************
  1896.                ***** #warez IS NOT SAFE!!!!!!!!!!!!! *****
  1897.                *******************************************
  1898.  
  1899. Last year, Microsoft alone budgeted over $5 million for busting internet
  1900. pirates through monitoring and talking to them on #warez.  It's a great
  1901. place to meet contacts, but never, NEVER give someone software or a site
  1902. info unless you trust them, or they trade you enough stuff back for it
  1903. that you trust them.  SUSPECT EVERYONE.  See sections 5.3 and 5.4.
  1904.  
  1905. 5.3 Information Trading
  1906. -----------------------
  1907.  
  1908. Eventually you will build up some contacts.  Be patient; it takes ages
  1909. to reach trusted status on #warez, or with other pirates.  Be helpful;
  1910. upload a shitload until people like you and know your pseudo.  Then they
  1911. will trust you with new sites, etc.  Keep finding active sites with
  1912. archie and giving them to the people YOU trust, etc.  Build up a rep;
  1913. it's the only way to go unless you know someone who'll find all your
  1914. sites for you (not very likely).
  1915.  
  1916. Anwyays, the key to doing this successfully is information trading.
  1917. Information is the only commodity you've got to work with, so don't
  1918. throw it around freely.  For instance, there are certain self-righteous
  1919. assholes (they're probably Reform-party voting Baptist freaks) who take
  1920. on the anti-piracy crusade.  They call themselves "deleters".  They pose
  1921. as pirates, sucker sites out of the unwary, then go onto those sites and
  1922. write down any other sites that are advertised there.  Then, whenever
  1923. they have free time, they log onto the site, delete any wares there
  1924. (it's anonymous-ftp so anyone can delete anything), and leave taunting
  1925. feelgood ethically correct jeers in return.  Once a site gets a deleter
  1926. it's fucked and no one will post where it's moving too or anything,
  1927. beucase of course the shithead will pick up on that and move onwards.
  1928.  
  1929. This is just one example of why you have to use a lot more discresion
  1930. than you're used to in regular piracy.  Anways, if you pretend everyone
  1931. you meet is out to get you, then you should be just fine.  Don't give
  1932. out anything for nothing.  Especially in Internet Piracy, there ain't no
  1933. such thing as a free lunch.
  1934.  
  1935. 5.4 Paranoia (how not to get caught)
  1936. ------------------------------------
  1937.  
  1938. This section covers the general philosophy of not getting caught,
  1939. Paranoia, and the best way to hide your tracks when you're pirating
  1940. files.
  1941.  
  1942. First off, whatever you do, be paranoid.  The problem with the people
  1943. trying to catch you, is that they are usually better than you are.  This
  1944. gives them an unfair advantage right of the boot.  You have to surprise
  1945. and outwit them.  Never never leave any incriminating evidence lying
  1946. around an account in non-encrypted form.  never leave your real name
  1947. anywehre on a hacked account.  Never get people to mail you there using
  1948. your real name or referring to you by any information that might get you
  1949. in trouble.
  1950.  
  1951. You can get around the mail problem (of giving unwary people your email
  1952. address) by getting an "anonymous mail-id".  There is this crazy guy in
  1953. Finland who keeps a NeXt locked in his basement to handle anonymous mail
  1954. for the whole world.  You do a "mail nick@anon.penet.fi" and it will
  1955. send you a nickname and instructions.  From ehre you can now give people
  1956. your anonymous nickname, and they send mail to you with this nickname at
  1957. @anon.penet.fi, and it gets forwarded to you without anyone knowing who
  1958. it was from.  This lets you hide behind anonyminity.  It's invaluable to
  1959. a pirate, so I suggest you get one.
  1960.  
  1961. Also, follow the rules I laid down in the last section about information
  1962. trading.  Trust no one, suspect everyone, don't tell no one nuthin'
  1963. without thinking carefully about it first.
  1964.  
  1965. The majority of this section concerns how to hide your FTP'ing. (or
  1966. FSP'ing).  This is ESSENTIAL READING if you plan to pirate.
  1967.  
  1968. First, never FTP to your home directory.  Stupid!  Dumb!
  1969.  
  1970. On your UNIX system there is a directory called /tmp.  This is where
  1971. users can make temporarily large files and keep them until it fills up
  1972. (at that point the /tmp directory is wiped clean automatically).
  1973. Anwyays, you can make your own directory off here and run ftp from that
  1974. directory (or explicitly put the files there in your "get" command).
  1975.  
  1976. Also, why make this directory visible?  Start it with a dot.
  1977.  
  1978. Also, why make the characters printable?  If you're using "tcsh" you can
  1979. easily do control characters in filenames.  I make my temp directory
  1980. something like this:  (type exactly as you see it.  Typing a Ctrl-V will
  1981. put "^V" on the screen in tcsh, and then when you type the next control
  1982. character, even if it's like a backspace (^H), it will replace the ^V.
  1983. This is how you embed control codes into filenames.  I'm not sure if it
  1984. works properly under the C-shell (csh) or not.
  1985.  
  1986. % mkdir /tmp/".   tmp  ^V^H ^V^H"
  1987.  
  1988. That's a bugger to get into if you don't know what it is.  It won't stop
  1989. a snooping system administrator for a second, but it will stop most
  1990. nosey users.
  1991.  
  1992. Now, when you are downloading a file, DON'T DOWNLOAD IT WITH THE PIRATE
  1993. FILENAME.  Stupid!  Dumb!
  1994.  
  1995. Give it a nice believable name so it looks legitimate.  Change the
  1996. file-type.  For instance, if it's WING2-1.ZIP, make it MOR3DDT1.ARJ or
  1997. something that sounds right, might be that size, and isn't the right
  1998. file extension.  Or you could give it a tricky filename, like above, but
  1999. this means you have to either rename it before you download, or take
  2000. your chances on what DOS does with that filename (not good if it begins
  2001. with a period).
  2002.  
  2003. You can make it harder still.  Use PGP to encrypt the file if you have
  2004. PGP.  Instead of leaving 5 disks there, use zip to archive them all
  2005. together.  If you use zip you can rename them all, zip them all into one
  2006. big archive (who cares that it's no compression) and put a password on
  2007. it in the process.  this is my preferred method.
  2008.  
  2009. A lot of UNIX systems don't have a new enough zip utility to put
  2010. passwords onto a zip.  Use the "arc" program - this is compatible with
  2011. the old PKXARC and PKUNPAK commands.  You make an archive with a
  2012. password using the "g" option for example:
  2013.  
  2014. % arc agpassword myarc *.arj
  2015.  
  2016. to add them all.  Remember to get rid of all the .arj files when done.
  2017. Then send it to yourself and just
  2018.  
  2019. C:\DOWNLOADS> pkxarc -g password myarc c:\destination\path\
  2020.  
  2021. That -g might be another letter depending on which de-arcer you use, but
  2022. they are compatible.  Now rename the .ARJ files back to the proper ZIP
  2023. names and you've done it.
  2024.  
  2025. This is a bit of a long process, but it IS THE ONLY WAY TO BE SAFE.
  2026. A good friend of mine was thrown out of his College and prosecuted for
  2027. having MS-DOS 6.0 in his home directory, unencrypted.  Microsoft nearly
  2028. took his ass to pieces (and still might).  It's worth the extra hassle
  2029. to keep yourself safe, as everyone who might catch you will take your
  2030. offenses very, VERY seriously.
  2031.  
  2032. Be sure to always clean up as soon as you are done.  rm -r the entire
  2033. directory out of the /tmp dir so no one suspects you were ever doing
  2034. anything. Check your home directory and make sure you didn't leave any
  2035. aborted xfers in THERE by mistake!  (it happens to everybody, so check
  2036. it).  All in all, just BE CAREFUL.
  2037.  
  2038. 5.5 Aside: Faking Mail
  2039. ----------------------
  2040.  
  2041. A fun UNIX trick is faking mail.  I'm not going to go into detail, but
  2042. some of you may really quite badly want to learn this trick.  Be careful
  2043. with it, but it's quite easy to use and pretty safe, as long as you
  2044. don't cross the wrong people.
  2045.  
  2046. [begin large hint]
  2047. % man mconnect
  2048. (mconnect does exactly the same thing as telnetting to port 25.)
  2049. [end large hint]
  2050.  
  2051. 5.6 Aside: Naughty Pictures
  2052. ---------------------------
  2053.  
  2054. There is a huge X-Rated .GIF industry going on the Internet, which
  2055. operates in a lot of the same manner as the pirate thing.  Usually the
  2056. people doing it aren't as skilled, but they are just as paranoid; it's
  2057. illegal and enforced not to spread pornography over the internet (at
  2058. least not by anonymous ftp; uuencoded pictures fill alt.sex.binaries).
  2059.  
  2060. I don't dabble in this so I have no idea how to get started.  If I were
  2061. to try though, I'd go about it in much the same manner as I suggested
  2062. you do the piracy thing.  There are sex channels on IRC, lots of sex
  2063. MUSH's, etc., and lots of alt.sex newsgroups.  Be careful, and don't get
  2064. caught (though the penalty for getting pornography would be much much
  2065. less compared to getting busted for pirating software).
  2066.  
  2067.  
  2068.                        ////////////////////////////
  2069.                       // 6.0 Onwards to Victory //
  2070.                      ////////////////////////////
  2071.  
  2072. Well, there you have it:  Baldrick's discrete guide to UNIX use.  This
  2073. guide took me a bloody long time to write as I kept completing sections
  2074. and then stopping for 6 months.  However, it's finally finished after 4
  2075. revisions and ends as you have it in your hands.
  2076.  
  2077. Since I started it I've learned a lot more about UNIX (there's an
  2078. endelss pyramid of knowledge to climb) and I hope you'll find yourself
  2079. snagged by the same curiosity.  It's a great way to hack and pirate etc.
  2080.  
  2081.              "Yo ho, ho, ho, it's a pirate's life for me"
  2082.                      - Unknown Amiga "Backup" Program,
  2083.                        sung, by a chorus of burly pirates,
  2084.                        when you load the beast up.
  2085.  
  2086.  
  2087.                               -=Baldrick=-
  2088.                               -=02/11/94=-
  2089.