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

Loading...

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



Loading


The Adobe Flash plugin is needed to view this content

Get the plugin now

View by Category
About This Presentation
Title:

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

Description:

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: http://www.cju.com
Category:

less

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


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

3
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.

4
Sample Exchange Sending, Receiving and
Retrieving Electronic Mail
Sending Mail
Retrieving Mail
Receiving Mail
Mail Spool
MDA
SMTP Connection
POP Server
SMTP Server
SMTP Server
MTA
MTA
SMTP and POP Servers can be the same system
POP Connection
SMTP Relay
MUA
MUA
Workstation
Workstation
5
SMTP
  • 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.

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

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

8
Sendmail
  • Can be downloaded from http//www.sendmail.org.
  • Started from /etc/rc.d/init.d/sendmail at boot
    time.
  • 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.

9
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/sendmail.cf 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
    address.
  • /var/spool/mqueue Queue for outgoing email
    messages.

10
Receiving Electronic Mail
  • The default storage location for incoming mail is
    /var/spool/mail/username.
  • 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.

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

12
Exercise Creating Aliases
  • Add the following entries to /etc/aliasesroot
    student, youremail_at_domain.com
  • Typegt /usr/bin/newaliases
  • Verify that your aliases are workinggt echo
    checking aliases /bin/mail rootgt cat
    /var/spool/mail/student

13
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.

14
POP3
  • 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
    systems

15
IMAP
  • Very similar to POP however, not yet as
    popular.
  • 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
    systems.

16
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.

17
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
    tasks.
  • Is actually a background system process -crond
    (the cron daemon) is started at boot time from rc
    scripts.

18
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

19
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,
    e.g.
  • /var/spool/cron/root
  • /var/spool/cron/chris
  • /var/spool/cron/mary
  • etc.

20
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

21
Sample Cron Entries
  • Sample entriesPing our mail file servers IP
    address every 15 min0,15,30,45 /sbin/ping 5
    192.168.15.7 /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

22
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.
    EDITORpico)

23
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
    unmodified)

24
/etc/crontab
  • 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
    /etc/cron.monthly
  • Non-standard way of using cron.

25
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
    internet.rutgers.edu account or another email
    address of your choice every 15 minutes of the
    hour.
  • Check /var/log/cron to verify that your job ran.

26
Syslogd
  • Most system logging is handled through the
    syslogd.
  • Configuration file is /etc/sylog.conf.
  • Log entries are directed to various files in
    /var/log.
  • 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.

27
/etc/syslog.conf
  • Format of syslog rulefacility.priority action
  • facility - system or application generating the
    message.
  • 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/syslog.pid

28
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.
About PowerShow.com