Unix comp 145
This presentation is the property of its rightful owner.
Sponsored Links
1 / 21

Unix Comp-145 PowerPoint PPT Presentation


  • 75 Views
  • Uploaded on
  • Presentation posted in: General

Unix Comp-145. Lecture 9: Introduction to System Administration Source: S. Das, “Your Unix: The ultimate Guide”, 2 nd Edition, McGraw Hill, 2006 Chapt 19. Shell Programming. Basic scope of operations for Sys Admin Booting the system Block and raw devices

Download Presentation

Unix Comp-145

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Unix comp 145

Unix Comp-145

Lecture 9: Introduction to System Administration

Source:

S. Das, “Your Unix: The ultimate Guide”, 2nd Edition, McGraw Hill, 2006Chapt 19

BROOKDALE COMMUNITY COLLEGE


Shell programming

Shell Programming

Basic scope of operations for Sys Admin

Booting the system

Block and raw devices

Concepts in using Scripts to do Sys Admin

Sys Admin Key Files

Concepts and commands to monitor Sys Perf

BROOKDALE COMMUNITY COLLEGE


Basic scope of operations for sys admin

Basic Scope of Operations for Sys Admin

  • System Admin login id, a.k.aSuperuser (SU)

    • root

    • DefaultPS1prompt = #

    • Home directory is /

  • When root changes its password it does not ask for the exiting password.

  • Root’s value for PATH

    • Never includes the current directory

    • Only includes /sbinor/user/sbinor both

  • /sbincontains most administrative commands

BROOKDALE COMMUNITY COLLEGE


Basic scope of operations for sys admin cont d

Basic Scope of Operations for Sys Admin (cont’d)

Superuser can switch from normal user to superuser (SU)

$ su –

Password: ********

#

Including Hyphen after su command assures same environment as root.

Omitting hyphen after su assures environment of user account from which su is executed, e.g., home directory

To exit su mode, type exitorctl-D

BROOKDALE COMMUNITY COLLEGE


Unix comp 145

Basic Scope of Operations for Sys Admin (cont’d)

  • su command used by non-privileged users must have user-id as argument

    • $ su – jmensing

    • Password: ********

    • #

  • If successful, recreates jmensing’s environment

BROOKDALE COMMUNITY COLLEGE


Unix comp 145

Scope of Operations for Sys Admin:

  • Administrator Privileges

  • Can change the contents or attributes of any file (e.g., access permissions & ownership)

  • Can delete any file even if it is write protected by the owner.

  • Initiate or kill any process except those necessary to run the Unix environment.

BROOKDALE COMMUNITY COLLEGE


Unix comp 145

  • Scope of Operations for Sys Admin:

  • Administrator Privileges (cont’d)

  • Can execute the passwd command to change any user’s password without knowing the existing.

    • $ passwdhenry

  • Use date to set or reset system clock

    • $ date <mmddhhmmss>

  • Use wallcommand to broadcast messages to all users who are logged in

    • Can display content of a file

    • appears on terminal even if users chose to deny all messages

  • BROOKDALE COMMUNITY COLLEGE


    Unix comp 145

    • Scope of Operations for Sys Admin:

    • Administrator Privileges (cont’d)

    • Limit max size of files that users are permitted to create [ulimit]

    • Control user access to scheduling services like at and cron

    • Control user access to many networking services like

      • $ftp # file transfer services

      • $ ssh# remote machine login service

      • $ ssh –f server1.brookdalecc.edu sleep 10

    BROOKDALE COMMUNITY COLLEGE


    Unix comp 145

    Scope of Operations for Sys Admin:

    • Management of control files (cont’d)

    • /etc/group

      • GroupName:Passwd:GID_Num:GrpMemberLst

      • File has 1 primary group

      • Plus, 1 or more supplemental groups

      • Contains GID (both name and number)

    • root::0:root # root user’s supplementary group

    • staff::1:

    • bin::2:root,bin,daemon

    • sys::3:root:bin,sys,adm

    • lp::8:root,lp,adm

    • student::100:

    • users:*:30:

    BROOKDALE COMMUNITY COLLEGE


    Unix comp 145

    Scope of Operations for Sys Admin:

    • Management of control files (cont’d)

    • Adding a member to a group [groupadd]

      • GroupName:Passwd:GID_Num:GrpMemberLst

      • Inserts an entry in to /etc/group file

      • Used to add new users to the system

      • Each option represents a field in the passwdfile

    • Deleting a member from a group [groupdel]

    • Modifying a member in a group [groupmod]

    BROOKDALE COMMUNITY COLLEGE


    Unix comp 145

    Scope of Operations for Sys Admin:

    • Management of control files (cont’d)

    • Syntax of /etc/passwdfile

    • root:*:0:0:Charlie &:/root:/bin/csh

    • User login name

    • Encrypted password (or x if shadow passwords are in use)

    • Numerical user ID (UID)

    • Default Numerical group ID (GID)

    • User’s full name (also known as the GECOS field)

    • Home directory

      • Default shell

      • NOTE:GECOS means General Electric Comprehensive Operating System. Attributeintroduced by AT&T Bell Labs because some of its early Unix systems used GCOS machines for print spooling and various other services.

    BROOKDALE COMMUNITY COLLEGE


    Unix comp 145

    Scope of Operations for Sys Admin:

    • Management of control files (cont’d)

    • Add a user into /etc/passwdfile

    • $ useradd –u 210 –g dba -c :The RDBMS” –d /home/oracle –s /bin/ksh –m oracle

    • MUST PROVIDE ALL ATTRIBUTES FOR PASSWD FILE’S ENTRY.

    • USUALLY PUT IN A SHELL

    BROOKDALE COMMUNITY COLLEGE


    Unix comp 145

    Scope of Operations for Sys Admin:

    • Management of control files (cont’d)

    • Deleting an entry from passwdfile [usrdel]

      • Deletes an entry, i.e., a user from the system

      • usrdel [-r] login

    • Modifying an entry in passwdfile [usermod]

      • Modifies some parameters of entry

      • usrmod [-ccomment] [-dhome_dir [ -m]] [-eexpire_date][-finactive_time] [-ginitial_group] [-Ggroup[,...]] [-llogin_name] [-ppasswd] [-sshell] [-uuid [ -o]] [-L|-U] login

    BROOKDALE COMMUNITY COLLEGE


    Unix comp 145

    System Boot Process

    • Controlled by automated shell scripts

    • After hardware is powered on, system looks for peripherals towards loading kernal into memory.

    • Kernal spawns init (PID=1) which

      • Maintains system at specific states and decides which process to run for each run level (state)

      • Parent of all system daemons that continuously runs is init .

      • Spawns a getty process for every terminal so that users can log in.

    • To reveal current run level value use who –r

    BROOKDALE COMMUNITY COLLEGE


    Unix comp 145

    System Boot

    • On boot, initrun level moves to 1 or s

    • On shutdown, initrun level moves to 0 or 6

    • Run Levels (states) – Distinct set of processes, mostly daemons scheduled to run in each state

      • 0System shutdown

      • 1System Admin mode (local file system mounted)

      • 2Multi-user mode (NFS not available)

      • 3Full multiuser mode

      • 5Graphical environment mode in Linux

      • 6Shutdown and reboot mode

      • S or SSingle user mode (file system mounted).

    BROOKDALE COMMUNITY COLLEGE


    Unix comp 145

    System Shutdown

    • $ shutdowncommand

    • On shutdown, executes wallto announce system shutting down and directive to log off.

    • Sleeps for 1 minute then:

      • Sends signals to all running processes so they can terminate normally

      • Logs user’s off and kills remaining processes

      • Unmounts all secondary file systems (usesunmountcommand)

      • Invokes sync to write all memory resident data to disk

      • Preserves integrity of filesystem

      • Notifies users to reboot or switch off, or moves sys to single user mode

    BROOKDALE COMMUNITY COLLEGE


    Unix comp 145

    System Shutdown

    • shutdowncommand (cont’d)

    • shutdown [-krhp][-o [-n]] time [warning-message]

    • Command options

      • -r Shutdown and reboot at specified time

      • -h Shutdown and halt at specified time

      • -pSystem halted and power turned off

      • -kKick everyone off

      • Timetime at which shutdown occurs in relative(+number of minutes) or absolute time (yymmddhhmm)

      • Warning message

      • -g<num>overrides default sleep value – expressed in minutes – not on sodapop

    BROOKDALE COMMUNITY COLLEGE


    Unix comp 145

    How INIT Controls The Sytem

    • Init takes all instructions from /etc/inittab

    • Controls the way the system is booted and powered down.

    BROOKDALE COMMUNITY COLLEGE


    Unix comp 145

    How INIT Controls The System (Cont’d)

    • Syntax: label:runLevels:action:command

    • Typical file content

      • fs::sysinit:/sbin/rcSsysinit > /dev/msglog 2 <>/dev/msglog </dev/console

      • is:3:initdefault:

      • s0:0:wait:/sbin/rc0 > /dev/msglog 2 <>/dev/msglog </dev/console

      • s1:1:respawn:/sbin/rc1 > /dev/msglog 2 <>/dev/msglog </dev/console

      • s2:2:wait:/sbin/rc2 > /dev/msglog 2 <>/dev/msglog </dev/console

      • s3:3:wait:/sbin/rc3 > /dev/msglog 2 <>/dev/msglog </dev/console

      • s6:6:wait:/sbin/rc6 > /dev/msglog 2 <>/dev/msglog </dev/console

    BROOKDALE COMMUNITY COLLEGE


    Unix comp 145

    How INIT controls the sytem

    • How to read S2 entry:

      • For run levels 2 & 3, script to run /sbin/rc2

      • Wait to complete before moving to other lines in this file

      • Log all messages in msglog

    • Other terms:

      • Respawn causes process to restart on termination.

      • Wait causes init to wait before continuing

      • Sysinit used for initializing system, may check for dirtiness of both file systems & active swap partitions, and sets hostname.

      • Initdefault – sets default system run level, e.g., 3 (full multiuser mode)

    BROOKDALE COMMUNITY COLLEGE


    Unix comp 145

    • Chapter 19 (Part 2)

    To Be Continued

    BROOKDALE COMMUNITY COLLEGE


  • Login