home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / c / cops_104.zip / cops_104 / checkacct / Article next >
Text File  |  1992-03-10  |  12KB  |  296 lines

  1. [The entire text of this article appeared in the Engineering Computer
  2.  Network's (ECN) "No Name Newsletter" September 1991]
  3.  
  4.                  Guide to Account Security
  5.                       Philip R. Moyer
  6.                       ------ -  -----
  7.  
  8. 1   WHAT IS AN ACCOUNT?
  9. -   ---- -- -- -------
  10. Accounts allow people to use the computer.  When you get an
  11. account, you are given a password and a home directory.  The
  12. home directory is a place on a disk where you can put your
  13. files.  Each account has a login associated with it.  There
  14. is one login per account.  For example, my login is "prm".
  15.  
  16. Each account has unique information associated with it.  One
  17. of these data is the user id (or uid). It is a number that
  18. identifies the login.  All files created by you will have
  19. your uid attached to them.
  20.  
  21. The operating system keeps track of who is logged on at any
  22. given time.  It also keeps track of which commands you
  23. execute and how much time it takes to execute them.  It also
  24. keeps track of where you logged in.  In some cases, the
  25. operating system can keep track of who creates or modifies
  26. files.
  27.  
  28.  It is very important that you keep your account secure; any
  29. user who has access to your login and password can
  30. masquerade as you.  If that person does something illegal,
  31. you could get blamed.  He or she could also remove or modify
  32. your files.
  33.  
  34. 2   LOGGING IN AND LOGGING OUT
  35. When you want to work on the computer, you must first
  36. identify yourself to the computer and prove you are who you
  37. say you are.  This process of identification and identity
  38. verification is called "logging in".  First, the computer
  39. identifies itself and prompts you for a login.  Here is an
  40. example:
  41.  
  42.        dynamo.ecn.purdue.edu  login:
  43.  
  44. You would then type in your login and the computer would
  45. prompt for a password:
  46.  
  47.         dynamo.ecn.purdue.edu  login: prm
  48.         Password:
  49.  
  50. You then type in your password.  The computer won't print
  51. the password as it is typed so other users can't see it on
  52. the screen.  After the computer checks to see that the
  53. password matches the one associated with the given login, it
  54. starts a shell and grants you access to the machine.
  55.  
  56. You log in differently depending on what shell you are
  57. using.  If you are using Bourne shell (your prompt is "$"),
  58. you log out by typing the control key and the "d" key at the
  59. same time.  If you are using csh, type the word "exit" or
  60. "logout" and you will be logged out.  The computer records
  61. the times you logged in and logged out.
  62.  
  63. 3   PASSWORDS
  64. Choosing a good password is very important, because
  65. unauthorized users are often able to steal accounts or gain
  66. access to a system by guessing passwords.  People who try to
  67. gain unauthorized access to a computer or a specific account
  68. are called "crackers".  If your account is compromised,
  69. because of either a bad password or other means, the cracker
  70. can not only remove or modify any of your files, but he/she
  71. can also attack other users on the system, or other systems
  72. on the network.
  73.  
  74. Good passwords are difficult to create; care and thought
  75. should go into each one.  Here are some guidelines for
  76. choosing passwords.
  77.  
  78. Bad passwords are:
  79.    - your login in any form
  80.             (as-is, reversed, capitalized, doubled, etc)
  81.    - any first or last name, yours or someone else's
  82.              (regardless of ordering or capitalization)
  83.    - license plate numbers
  84.    - phone numbers
  85.    - social security numbers
  86.    - brands or styles of automobiles
  87.    - street, city, state or country names
  88.    - all digits or all of the same letter
  89.    - any word found in a dictionary, English or other
  90.    - passwords shorter than six characters
  91.    - famous product names (Budweiser, Ruffles, etc)
  92.    - cartoon characters
  93.  
  94. Good passwords are usually pieces of several words, with odd
  95. capitalizations.  A good password may include punctuation or
  96. other non-alphabetic characters.  Using digits in unexpected
  97. locations can make a password better.
  98.  
  99. Use the passwd command to change your password.  Just type
  100. and you will be prompted for your old password (to verify
  101. that you are authorized to change it) and a new password.
  102. Then you will be prompted for the new password again, to
  103. make sure you didn't mis-type the new password.  
  104.  
  105. 4   KEEPING YOUR PASSWORD SECURE
  106. You should change your password as soon as you get an
  107. account, and then you should change it once every one or two
  108. months, just to be sure it isn't being used by anyone else.
  109.  
  110. Don't tell anyone what your password is, under any
  111. circumstances. Let me emphasize that.  Don't tell ANYONE.
  112. Under ANY circumstances.  There are crackers who have been
  113. known to send mail that appears to be from the system
  114. administrator, asking you to change your password to
  115. something they give you.  DON'T EVER DO THIS!  There is *no*
  116. legitimate reason for ANYONE to ask for your password.  If
  117. you ever get mail like this, go to your site specialist and
  118. report the incident.
  119.  
  120. Don't write your password down.  It's too easy for someone
  121. to discover it.  You should choose a password that you can
  122. remember.  If, however, you absolutely must write down your
  123. password, don't write it anywhere obvious, like on a post-it
  124. note stuck to your terminal, on the front of your notebook,
  125. or on a piece of paper next to the terminal.  Write it on
  126. something in your wallet and then be tricky by changing the
  127. written password in some way (like leaving out two key
  128. letters); so you can still remember it, but it is harder for
  129. a someone who sees the paper to get into the account.  Don't
  130. ever write your login and password on the same piece of
  131. paper.
  132.  
  133. You should also be very careful that someone isn't watching
  134. you when you log in.  Many people can tell what you are
  135. typing just by watching your fingers on the keyboard.
  136.  
  137. 5   DIRECTORIES AND FILES
  138. All information on the computer is stored in files.  A file
  139. is just what it sounds like, a container for data.  A
  140. directory is a special file that contains other files or
  141. directories.  You can list which files are in a directory
  142. using the ls command. For example, here's what ls says about
  143.           --                                   --
  144. the directory (/home/harbor3/prm/pub/articles) where I'm
  145. located.
  146.  
  147. RFC1147.ps    acct.sec    imp.tech     new.security
  148. orange-book   privacy     pu.environ   ritalin
  149. s.serv        s.serv.tr   style        wwarticle
  150. zap
  151.  
  152. You can use ls to find out additional information about
  153.             --
  154. files by using the "-l" option.  For example, if I wanted
  155. more information about the file acct.sec in the list above,
  156. I would type Here is what happens when I do that:
  157.  
  158. -rw-r--r--  1 prm  8058 Aug 19 11:22 acct.sec
  159.  
  160.    - The first field shown as, "-rw-r--r--", is the file
  161.      type and permission bits.  More information about
  162.      permission codes is given below.
  163.  
  164.    - The second field, "1", is the number of links to the
  165.      file.  In this case, the file has only one name.  Other
  166.      links can be made with the "ln" command.
  167.  
  168.    - The third field, "prm", is the file's owner.  The login
  169.      prm owns this file.
  170.  
  171.    - The fourth field, "8058", is the size of the file in
  172.      number of characters.
  173.  
  174.    - The fifth field, "Aug 19 11:22", is the time the file
  175.      was last modified.
  176.  
  177.    - The last field is the name of the file.
  178.  
  179. Permission Codes
  180. The first character in the type/permission field is the file
  181. type.  If the file is a directory, the first character will
  182. be a "d".  If it is a regular file, the first character will
  183. be "-".
  184.  
  185. The next nine characters are access permission flags.  The
  186. leftmost three are owner permissions, the middle three are
  187. group permissions, and the rightmost three are world
  188. permissions.  The letter "r" grants read permission, the
  189. letter "w" grants write permission, and the letter "x"
  190. grants execute permission.
  191.  
  192. In the above example, the permissions for the owner, "prm",
  193. are "rw-".  That means the owner "prm" can read and write
  194. the file, but not execute it.  The permissions for the
  195. file's group are "r--", as they are for the world.  
  196. If a file has modes "rw-rw----" and is owned by group other, 
  197. everyone on the computer can write to the file!  You can see 
  198. group ownership on a file by using the "g" option with the "l" 
  199. option to ls.
  200.           --
  201. For example, when I type "ls" I get the following:
  202.  
  203. -rw-r--r--  1 prm  other  8058 Aug 19 11:22 acct.sec
  204.  
  205. The "other" is the group owner of the file.
  206.  
  207. You can use the chmod command to change file permissions.
  208.                 -----
  209. The character "+" means add permission and the character "-"
  210. means deny permission.  For example, if I wanted to let
  211. people in group "other" write on my file, I would type
  212. Whereas if I want to deny other people permission to look at
  213. this file, I could type and the read permission on the file
  214. would be revoked.
  215.  
  216. There is a shorthand way of representing file modes.  Each
  217. permission category (owner, group, and world) is given a
  218. number which represents the bits set in the permission
  219. field. Here is a table that explains this numbering system:
  220.  
  221.              _________________________________
  222.             |           Owner   Group   World|
  223.              _________________________________
  224.             | Read       400     40       4  |
  225.             | Write      200     20       2  |
  226.             | Execute    100     10       1  |
  227.               None         0      0       0
  228.             |________________________________+
  229.  
  230. To use this table, merely add up the permissions you want.
  231. For example, a file that is mode 644 has owner read and
  232. write permission (400 + 200), group read permission (40),
  233. and world read permission (4).
  234.  
  235. You can use this shorthand with chmod as well.  Just use the
  236.                                 -----
  237. number instead of the symbolic representation.  If you want
  238. to change the mode of your .login from 755 to 644, you can
  239.                             -----
  240. type:
  241.     /bin/chmod 0644 .login
  242.  
  243. Your home directory should be mode 700, 711, or 755.  You
  244. should not allow others write permission to your directory!
  245. That would give them permission to create or destroy files
  246. at will.
  247.  
  248. Important files should be mode 644 or 600.  Only rarely is
  249. it important to make a file mode 666, which is world-
  250. writable.
  251.  
  252. 6   IMPORTANT FILES
  253. Most accounts have special files called "dot" files.  These
  254. files control the startup, environment, and execution of the
  255. shell and some programs.  It is very, very important that
  256. these files not be writable by anyone but you!  If someone
  257. else can write those files, they can take control of your
  258. account in a matter of minutes!  Then they'll be you, which
  259. means they can do anything you can do: read, write or modify
  260. files; send mail; talk to other users; print documents.
  261. Make sure that permissions on these files are set to 644,
  262. or, better yet, 600:
  263.  
  264.  
  265.  
  266.                .login     .logout    .cshrc
  267.                .bashrc    .kshrc     .xinitrc
  268.                .exrc      .dbxinit   .profile
  269.                .sunview   .mwmrc     .twmrc
  270.  
  271. 7   PHYSICAL SECURITY
  272. Try to be aware of physical security.  When you are logged
  273. in on a terminal or workstation, don't leave it without
  274. locking the screen.  Often, this means that you shouldn't
  275. even go to the next room to get output without locking your
  276. screen.  It only takes two commands ("cp and chmod") for
  277. someone to steal access to your account if they can find it
  278. logged in and unattended, so be careful!
  279.  
  280. 8   ACCOUNT SHARING
  281. You may, at one time or another, feel you need to give
  282. someone else access to your account.  There are several ways
  283. you could go about doing this, the most common of which are
  284. .rhosts files, giving the person your password, and making
  285.  ------
  286. your directory mode 777.  Please don't give anyone else
  287. access to your account.  It's too easy for them to do
  288. something malicious.  Don't let a friend set up a dot file
  289. for you.  Don't use programs in other people's directories.
  290. Don't trust people to leave your account alone.  If you let
  291. someone edit your .login because you don't really understand
  292.                    -----
  293. how a .login works, you've essentially given them your
  294.        -----
  295. account, even if you change the password.
  296.