ITI481: Unix Administration Meeting 5 Christopher Uriarte Rutgers University Center for Applied Comp - PowerPoint PPT Presentation


PPT – ITI481: Unix Administration Meeting 5 Christopher Uriarte Rutgers University Center for Applied Comp PowerPoint presentation | free to download - id: 51ea2-MzdkY


The Adobe Flash plugin is needed to view this content

Get the plugin now

View by Category
About This Presentation

ITI481: Unix Administration Meeting 5 Christopher Uriarte Rutgers University Center for Applied Comp


Examples: mail, Pine, Netscape Mail, Outlook. Mail Transport Agent(MTA) ... var/spool/cron/chris /var/spool/cron/mary. etc. Crontab File Format ... – PowerPoint PPT presentation

Number of Views:33
Avg rating:3.0/5.0
Slides: 29
Provided by: kkap
Learn more at:


Write a Comment
User Comments (0)
Transcript and Presenter's Notes

Title: ITI481: Unix Administration Meeting 5 Christopher Uriarte Rutgers University Center for Applied Comp

ITI-481 Unix AdministrationMeeting
5Christopher UriarteRutgers University Center
for Applied Computing Technologies
Todays Agenda
  • Job Scheduling - The Cron Program
  • Syslogd and Logging
  • Sendmail and UNIX mail concepts

Electronic Mail System Components
  • Mail User Agent (MUA)
  • Provides interface for reading mail, writing new
    messages, and filing. Also called a mailer.
  • Examples mail, Pine, Netscape Mail, Outlook.
  • Mail Transport Agent(MTA)
  • Routes mail from one user to another either
    locally or across systems.
  • Uses a transport protocol, usually SMTP (Simple
    Mail Transport Protocol), to provide the medium
    for mail transfer.
  • Examples Sendmail, Qmail.
  • Mail Delivery Agent (MDA)
  • Takes a message once received at a site and gets
    it to the appropriate user mailbox.
  • Examples procmail, mail.

Sample Exchange Sending, Receiving and
Retrieving Electronic Mail
Sending Mail
Retrieving Mail
Receiving Mail
Mail Spool
SMTP Connection
POP Server
SMTP Server
SMTP Server
SMTP and POP Servers can be the same system
POP Connection
SMTP Relay
  • The SMTP protocol defines the method by which
    mail is sent from one host to another.
  • SMTP usually uses port 25 mail servers will be
    listening for incoming mail messages.
  • No authentication required to use SMTP services
    anybody can send mail without providing a
    username/password to send it.

Sample SMTP Exchange with a Mail Server
  • amenti 5.5 gt telnet 25
  • Trying
  • Connected to iti.Rutgers.EDU.
  • Escape character is ''.
  • 220 ESMTP Sendmail 8.9.3/8.8.7
    Mon, 15 May 2000 203248 -0400
  • helo
  • 250 Hello, pleased to meet you
  • mail from
  • 250 Sender ok
  • rcpt to
  • 551 we do not relay
  • rcpt to
  • 250 Recipient ok
  • data
  • 354 Enter mail, end with "." on a line by itself
  • This is a test.
  • .
  • 250 UAA03425 Message accepted for delivery

Exercise Sending a Message
  • Log into using ssh.
  • Telnet to port 25 on your iti.rutgers.edugt
    telnet 25
  • Compose and send out an email message helo ltentergtmail from
    ltentergtrcpt to
    ltentergt data ltentergtThis is a test. ltentergt.
  • Verify that your message was receivedgt less
  • Try reading the message in pine. typegt
    pineAccess your inbox. What information about
    the message is hidden from the typical user view?

  • Can be downloaded from http//
  • Started from /etc/rc.d/init.d/sendmail at boot
  • Responsible for sending and receiving email
    messages. Once mail is received, it gets
    passed off to a MDA to deliver message to
    appropriate user mail box.

Sendmail Components
  • /usr/sbin/sendmail Sendmail binary. Started by
    default with options bd q1h. Sendmail is
    started by an rc script when system boots.
  • /etc/ Main configuration file.
    Defines rule sets that dictate Sendmail's
    behavior. Often also points to other sendmail
    configuration files in /etc.
  • /etc/aliases or /etc/mail/aliases Used to create
    mailing lists or to give users alternative email
  • /var/spool/mqueue Queue for outgoing email

Receiving Electronic Mail
  • The default storage location for incoming mail is
  • Mail can be redirected to other local or remote
    email address through .forward files in user home
    directories or /etc/aliases on a system level.

Aliases File
  • Entry formatusername newusergroupname user1,
  • Sample entiesroot
    staff kkaplan,jsmith,jdoe
  • After editing /etc/aliases, for changes to take
    effect, need to rungt /usr/bin/newaliases

Exercise Creating Aliases
  • Add the following entries to /etc/aliasesroot
  • Typegt /usr/bin/newaliases
  • Verify that your aliases are workinggt echo
    checking aliases /bin/mail rootgt cat

Retrieving and Reading Email
  • SMTP is a transport mechanism for sending mail
    only. An SMTP server will not allow a user to
    read or retrieve his/her mail.
  • Options for reading or retrieving email
  • Use a MUA to access directly the file system
    where the incoming mail is stored.
  • Post Office Protocol (POP) permits mail to be
    downloading from a POP server to a POP client.
  • Internet Message Access Protocol (IMAP) IMAP
    server maintains a central repository for IMAP
    account mail messages. Users can read, write,
    and file messages using an IMAP client.

  • Uses a server process to handle requests to
    retrieve email.
  • Usually uses port 110.
  • Unlike SMTP, POP is an authenticated protocol.
    (users must provide a username and password to
    retrieve mail)
  • Installed by default and enabled on most UNIX

  • Very similar to POP however, not yet as
  • Uses a server process to handle requests to
    retrieve email.
  • Usually uses port 143.
  • IMAP is an authenticated protocol. (users must
    provide a username and password to retrieve mail)
  • Installed by default and enabled on most UNIX

Job Scheduling in UNIX
  • Sometimes its desirable to schedule an
    application or script to execute unattended at a
    certain time of day or at a certain frequency.
  • System backups (backup the /home filesystem to
    tape every night at 200am)
  • Scripts that check system files (check to see if
    the /etc/password and and /etc/shadow files have
    been changed in the last 24 hours and email me if
    they have)
  • Scripts that mail reports or log files (email me
    the last 200 lines of the system security log
    every morning)
  • UNIX administrators need a reliable way to
    schedule unattended jobs and, possibly, give
    users the ability to schedule unattended jobs.

The Cron Program
  • UNIXs answer to automated job scheduling.
  • Used to schedule jobs to run at particular time
    or at a particular frequency.
  • Useful to to automate system administration
  • Is actually a background system process -crond
    (the cron daemon) is started at boot time from rc

Cron Files
  • Configuration files defining scheduled jobs are
    stored in multiple locations on some systems
  • /var/spool/cronThe mail Cron directory, where
    jobs defined according to username. These
    definition files are called crontab files.
  • /etc/crontabDefines cron jobs to be run hourly,
    daily, weekly, and monthly

Cron Files, cont.
  • Each user on the system can have a corresponding
    crontab file specifying their own automated job
    schedule including root.
  • The simple text files are kept under the
    /var/spool/cron directory, named after each user,
  • /var/spool/cron/root
  • /var/spool/cron/chris
  • /var/spool/cron/mary
  • etc.

Crontab File Format
  • Crontab files use the following format, placing
    one job entry on each lineMinute Hour Day Month
    DayOfWeek Command
  • Time fields are as follows
  • Minute (0-59)
  • Hour (0-23)
  • Day of Month (1-31)
  • Month (0-12 or names jan-dec
  • Day of Week (0-6 or names mon-fri)
  • Fields that are not specified for a particular
    entry are substituted with
  • Ranges can be specified by placing a - between
    elements, such as mon-fri

Sample Cron Entries
  • Sample entriesPing our mail file servers IP
    address every 15 min0,15,30,45 /sbin/ping 5 /bin/mail root
  • Mail a disk usage report every Friday at
    500PM0 17 fri df /bin/mail root
  • Remember the format
  • Minute Hour Day Month DayOfWeek Command

Editing Crontab files
  • Although crontab files are simple text files,
    they cannot be edited by opening them directly
    with a text editor like vi,emacs,pico, etc.
  • You must use the crontab program to edit a users
    crontab file
  • To use the crontabgt crontab u username e
  • Crontab will open the specified crontab file in
    the default system editor (usually vi). You can
    have it use your favorite text editor by setting
    the EDITOR environment varialble (I.e.

Editing Crontab files, cont.
  • If you do not format your cron entry correctly,
    the cron program will notify you when you attempt
    to exit your editor.
  • You will then have the chance to fix the entry or
    exit your editor (which leaves the crontab file

  • Defines a set of directories that will run
    scripts or links located in those directories at
    specified times.
  • Predefined cron directories/etc/cron.hourly
    /etc/cron.daily /etc/cron.weekly
  • Non-standard way of using cron.

Exercise Creating Crontab Entries
  • Edit the root crontab filegt cd
    /var/spool/crongt crontab u root -e
  • Create a crontab entry to run out of the root
    account to email a disk usage report to your account or another email
    address of your choice every 15 minutes of the
  • Check /var/log/cron to verify that your job ran.

  • Most system logging is handled through the
  • Configuration file is /etc/sylog.conf.
  • Log entries are directed to various files in
  • Messages logged by syslogd include a time stamp,
    the process or facility that delivered the
    message, and the message itself.
  • Rotating log files periodically is recommended.

  • Format of syslog rulefacility.priority action
  • facility - system or application generating the
  • priority level of severity of the message.
  • Wild cards are accepted.
  • Sample entriesauthpriv. /var/log/securemail.
    err /var/log/maillog
  • Tab delineated file.
  • If changes are made need to restart syslog
    daemongt kill HUP cat /var/run/

Additional Log Files
  • /var/run/utmp information about who is
    currently logged into system. Used by commands
    such as who and finger.
  • /var/log/wtmp login times and duration for each
    user on the system. Can view with last command.
  • /var/log/lastlog similar to wtmp but used by
    different programs, such as finger.