squeak!
Syllabus Homepage
Course Overview
Course resources
Day 1
Day 2
Day 3
Day 4
Common errors
Internet Glossary
About Your Instructor
Credits: This site powered by the vi text editor, apache webserver, perl scripting, and Debian linux.
squeak!

Unix Admin Pt3 - Day 3

Goals

In this session you will:
  • identify disk space waste
  • control disk space usage
  • control resources at the shell level
  • control access to specific programs
  • learn how your server relates to its network

POST

  1. BEFORE logging into the admin box across town, answer this: what is the normal load like on the box?
  2. go ahead an log onto that box
  3. what is the load like now? How would you characterize it?
  4. what might you do about it?

Identify disk space waste

  • usual suspects
    1. users storing personal files on your box
    2. untrimmed logfiles
    3. temp files in /tmp and /var/tmp directories
    4. temp files in place *~ *.bak
    5. core dumps core
    6. unpacked installation tarballs
    7. ftp://ftp.yourisp.com/incoming
  • tools
    • df
    • du
    • find p. 72
      • nice find path -atime +180 find files that haven't been used in 180+ days.
      • nice find path -mtime +180 find files that haven't been updated in 180+ days.
      • nice find path -size +1000k find files that are larger than 1MB (1000k). Read the manpage, though. The k option may not be standard (512byte blocks are standard).
      • nice find path -name *.tmp -o -name *.bak find backup and tempfiles
      • nice find path -name *.tmp -o -name *.bak -exec rm {} \; find backup and tempfiles and nuke them
      • find is also nice because it recurses
    • cat /dev/null > logfile

control disk space usage

  • quota is your main weapon. Here is a sample entry:
    
    Quotas for user bob:
    /dev/hda1: blocks in use: 34496, limits (soft = 35000, hard = 50000)
            inodes in use: 441, limits (soft = 0, hard = 0)
    
    • you will need to set quotas on any partition you want to protect (this will affect how you set up new systems)
    • use edquota -u user to set quota
    • use edquota -t to set system time limits
    • use edquota -g group to set group quota
    • use edquota -p prototypical user user to set quota from the prototypical user
    • use repquota -a to see how everybody's doing
    • quota is impersonal

    control resources at the shell level

    • log straight into application
    • log straight into menu
    • log into a restricted shell like rbash pp 187
    • use a shell wrapper (a safe sandbox) like lshell:

      root - // No limits for root
      mouse -
      default C60P30D20F24 // Default limits, 60 min's CPU time, 30 processes, 20Mb, 24 file descriptors

    learn how your server relates to its network

    • tcp/ip
    • hostname
    • localhost
    • fakenets
    • inetd v. daemons
    • ping
    • traceroute
    • nslookup
    • whois

    Homework

    • nfs pp.607-15
    • memory bottlenecks pp.303-12.


    http://www.mousetrap.net/syllabus/admin_unix_pt3/day3.html
    $Id: day3.orb,v 1.6 2002/04/09 13:21:39 mouse Exp $

    Remember, your login is based on your machine's hostname, not on any other number.
    ~/[initials] refers to the subdirectory under your homedir, named after your initials. Everything except for .dotfiles will be stored in your ~/[initials] directory.


© 1995-2001 jason carr
Distributed under the terms of the GNU Free Documentation License.