Presentation is loading. Please wait.

Presentation is loading. Please wait.

Unix Comp-145 L ECTURE 9: I NTRODUCTION TO S YSTEM A DMINISTRATION S OURCE : S. D AS, “Y OUR U NIX : T HE ULTIMATE G UIDE ”, 2 ND E DITION, M C G RAW H.

Similar presentations


Presentation on theme: "Unix Comp-145 L ECTURE 9: I NTRODUCTION TO S YSTEM A DMINISTRATION S OURCE : S. D AS, “Y OUR U NIX : T HE ULTIMATE G UIDE ”, 2 ND E DITION, M C G RAW H."— Presentation transcript:

1 Unix Comp-145 L ECTURE 9: I NTRODUCTION TO S YSTEM A DMINISTRATION S OURCE : S. D AS, “Y OUR U NIX : T HE ULTIMATE G UIDE ”, 2 ND E DITION, M C G RAW H ILL, 2006 C HAPT 19 BROOKDALE COMMUNITY COLLEGE111/19/2009 rwj

2 BROOKDALE COMMUNITY COLLEGE2 S HELL P ROGRAMMING B ASIC SCOPE OF OPERATIONS FOR S YS A DMIN B OOTING THE SYSTEM B LOCK AND RAW DEVICES C ONCEPTS IN USING S CRIPTS TO DO S YS A DMIN S YS A DMIN K EY F ILES C ONCEPTS AND COMMANDS TO MONITOR S YS P ERF 11/19/2009 rwj

3 BROOKDALE COMMUNITY COLLEGE3 B ASIC S COPE OF O PERATIONS FOR S YS A DMIN S YSTEM A DMIN LOGIN ID, A. K. A S UPERUSER (SU) – root – D EFAULT PS1 PROMPT = # – H OME DIRECTORY IS / W HEN ROOT CHANGES ITS PASSWORD IT DOES NOT ASK FOR THE EXITING PASSWORD. R OOT ’ S VALUE FOR PATH – N EVER INCLUDES THE CURRENT DIRECTORY – O NLY INCLUDES /sbin OR /user/sbin OR both /sbin CONTAINS MOST ADMINISTRATIVE COMMANDS 11/19/2009 rwj

4 B ASIC S COPE OF O PERATIONS FOR S YS A DMIN (cont’d) S UPERUSER CAN SWITCH FROM NORMAL USER TO SUPERUSER (SU) $ su – Password: ******** # I NCLUDING H YPHEN AFTER su COMMAND ASSURES SAME ENVIRONMENT AS ROOT. O MITTING HYPHEN AFTER su ASSURES ENVIRONMENT OF USER ACCOUNT FROM WHICH su IS EXECUTED, E. G., HOME DIRECTORY T O EXIT su MODE, TYPE exit OR ctl-D BROOKDALE COMMUNITY COLLEGE411/19/2009 rwj

5 BROOKDALE COMMUNITY COLLEGE5 B ASIC S COPE OF O PERATIONS FOR S YS A DMIN (cont’d) SU COMMAND USED BY NON - PRIVILEGED USERS MUST HAVE USER - ID AS ARGUMENT $ su – jmensing Password: ******** # I F SUCCESSFUL, RECREATES JMENSING ’ S ENVIRONMENT

6 BROOKDALE COMMUNITY COLLEGE6 C AN CHANGE THE CONTENTS OR ATTRIBUTES OF ANY FILE ( E. G., ACCESS PERMISSIONS & OWNERSHIP ) C AN DELETE ANY FILE EVEN IF IT IS WRITE PROTECTED BY THE OWNER. I NITIATE OR KILL ANY PROCESS EXCEPT THOSE NECESSARY TO RUN THE U NIX ENVIRONMENT. 11/19/2009 rwj S COPE OF O PERATIONS FOR S YS A DMIN : A DMINISTRATOR P RIVILEGES

7 BROOKDALE COMMUNITY COLLEGE711/19/2009 rwj C AN EXECUTE THE PASSWD COMMAND TO CHANGE ANY USER ’ S PASSWORD WITHOUT KNOWING THE EXISTING. $ passwd henry U SE DATE TO SET OR RESET SYSTEM CLOCK $ date U SE wall COMMAND TO BROADCAST MESSAGES TO ALL USERS WHO ARE LOGGED IN –C AN DISPLAY CONTENT OF A FILE – APPEARS ON TERMINAL EVEN IF USERS CHOSE TO DENY ALL MESSAGES S COPE OF O PERATIONS FOR S YS A DMIN : A DMINISTRATOR P RIVILEGES (cont’d)

8 BROOKDALE COMMUNITY COLLEGE811/19/2009 rwj L IMIT MAX SIZE OF FILES THAT USERS ARE PERMITTED TO CREATE [ ulimit ] C ONTROL USER ACCESS TO SCHEDULING SERVICES LIKE at AND cron C ONTROL USER ACCESS TO MANY NETWORKING SERVICES LIKE $ ftp # file transfer services $ ssh # remote machine login service $ ssh –f server1.brookdalecc.edu sleep 10 S COPE OF O PERATIONS FOR S YS A DMIN : A DMINISTRATOR P RIVILEGES (cont’d)

9 11/19/2009 rwjBROOKDALE COMMUNITY COLLEGE9 /etc/group GroupName:Passwd:GID_Num:GrpMemberLst —F ILE HAS 1 PRIMARY GROUP —P LUS, 1 OR MORE SUPPLEMENTAL GROUPS —C ONTAINS 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: S COPE OF O PERATIONS FOR S YS A DMIN : M ANAGEMENT OF CONTROL FILES ( CONT ’ D )

10 BROOKDALE COMMUNITY COLLEGE1011/19/2009 rwj Adding a member to a group [ groupadd ] GroupName:Passwd:GID_Num:GrpMemberLst —I NSERTS AN ENTRY IN TO / ETC / GROUP FILE —U SED TO ADD NEW USERS TO THE SYSTEM —E ACH OPTION REPRESENTS A FIELD IN THE passwd FILE Deleting a member from a group [ groupdel ] Modifying a member in a group [ groupmod ] S COPE OF O PERATIONS FOR S YS A DMIN : M ANAGEMENT OF CONTROL FILES ( CONT ’ D )

11 11/19/2009 rwjBROOKDALE COMMUNITY COLLEGE11 S YNTAX OF /etc/passwd FILE root:*:0:0:Charlie &:/root:/bin/csh o User login name o Encrypted password (or x if shadow passwords are in use) o Numerical user ID (UID) o Default Numerical group ID (GID) o User’s full name (also known as the GECOS field) o Home directory o Default shell NOTE:GECOS means General Electric Comprehensive Operating System. Attribute introduced by AT&T Bell Labs because some of its early Unix systems used GCOS machines for print spooling and various other services. S COPE OF O PERATIONS FOR S YS A DMIN : M ANAGEMENT OF CONTROL FILES ( CONT ’ D )

12 BROOKDALE COMMUNITY COLLEGE1211/19/2009 rwj A DD A USER INTO /etc/passwd FILE $ useradd –u 210 –g dba -c :The RDBMS” –d /home/oracle –s /bin/ksh –m oracle o MUST PROVIDE ALL ATTRIBUTES FOR PASSWD FILE’S ENTRY. o USUALLY PUT IN A SHELL S COPE OF O PERATIONS FOR S YS A DMIN : M ANAGEMENT OF CONTROL FILES ( CONT ’ D )

13 11/19/2009 rwjBROOKDALE COMMUNITY COLLEGE13 D ELETING AN ENTRY FROM passwd FILE [ usrdel ] –Deletes an entry, i.e., a user from the system – usrdel [-r] login M ODIFYING AN ENTRY IN passwd FILE [ usermod ] –Modifies some parameters of entry – usrmod [-c comment] [ -d home_dir [ -m ]] [ -e expire_date] [ -f inactive_time] [ -g initial_group] [ -G group[,...]] [ -l login_name] [ -p passwd] [ -s shell] [ -u uid [ -o ]] [ -L|-U ] login S COPE OF O PERATIONS FOR S YS A DMIN : M ANAGEMENT OF CONTROL FILES ( CONT ’ D )

14 BROOKDALE COMMUNITY COLLEGE1411/19/2009 rwj 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 1.Maintains system at specific states and decides which process to run for each run level (state) 2.Parent of all system daemons that continuously runs is init. 3.Spawns a getty process for every terminal so that users can log in. To reveal current run level value use who –r S YSTEM B OOT P ROCESS

15 11/19/2009 rwjBROOKDALE COMMUNITY COLLEGE15 O N BOOT, init RUN LEVEL MOVES TO 1 or s O N SHUTDOWN, init RUN LEVEL MOVES TO 0 or 6 R UN L EVELS ( STATES ) – D ISTINCT SET OF PROCESSES, MOSTLY DAEMONS SCHEDULED TO RUN IN EACH STATE 0S YSTEM SHUTDOWN 1S YSTEM A DMIN MODE ( LOCAL FILE SYSTEM MOUNTED ) 2M ULTI - USER MODE (NFS not available) 3F ULL MULTIUSER MODE 5G RAPHICAL ENVIRONMENT MODE IN L INUX 6S HUTDOWN AND REBOOT MODE S or SS INGLE USER MODE ( FILE SYSTEM MOUNTED ). S YSTEM B OOT

16 11/19/2009 rwjBROOKDALE COMMUNITY COLLEGE16 $ shutdown COMMAND O N SHUTDOWN, EXECUTES wall TO ANNOUNCE SYSTEM SHUTTING DOWN AND DIRECTIVE TO LOG OFF. S LEEPS FOR 1 MINUTE THEN : 1.S ENDS SIGNALS TO ALL RUNNING PROCESSES SO THEY CAN TERMINATE NORMALLY 2.L OGS USER ’ S OFF AND KILLS REMAINING PROCESSES 3.U NMOUNTS ALL SECONDARY FILE SYSTEMS ( USES unmount COMMAND ) 4.I NVOKES SYNC TO WRITE ALL MEMORY RESIDENT DATA TO DISK 5.P RESERVES INTEGRITY OF FILE SYSTEM 6.N OTIFIES USERS TO REBOOT OR SWITCH OFF, OR MOVES SYS TO SINGLE USER MODE S YSTEM S HUTDOWN

17 BROOKDALE COMMUNITY COLLEGE1711/19/2009 rwj shutdown COMMAND ( CONT ’ D ) shutdown [-krhp][-o [-n]] time [warning-message] C OMMAND OPTIONS -r S HUTDOWN AND REBOOT AT SPECIFIED TIME -h S HUTDOWN AND HALT AT SPECIFIED TIME -p S YSTEM HALTED AND POWER TURNED OFF -k K ICK EVERYONE OFF Time TIME AT WHICH SHUTDOWN OCCURS IN RELATIVE (+number OF MINUTES ) or ABSOLUTE time (yymmddhhmm) Warning message -g OVERRIDES DEFAULT SLEEP VALUE – EXPRESSED IN MINUTES – not on sodapop S YSTEM S HUTDOWN

18 11/19/2009 rwjBROOKDALE COMMUNITY COLLEGE18 I NIT TAKES ALL INSTRUCTIONS FROM /etc/inittab C ONTROLS THE WAY THE SYSTEM IS BOOTED AND POWERED DOWN. H OW INIT C ONTROLS T HE S YTEM

19 11/19/2009 rwjBROOKDALE COMMUNITY COLLEGE19 S YNTAX : label:runLevels:action:command T YPICAL FILE CONTENT fs::sysinit:/sbin/rcS sysinit > /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 H OW INIT C ONTROLS T HE S YSTEM (C ONT ’ D )

20 11/19/2009 rwjBROOKDALE COMMUNITY COLLEGE20 H OW TO READ S2 ENTRY : o F OR RUN LEVELS 2 & 3, SCRIPT TO RUN / SBIN / RC 2 o W AIT TO COMPLETE BEFORE MOVING TO OTHER LINES IN THIS FILE o L OG ALL MESSAGES IN msglog O THER TERMS : oR ESPAWN CAUSES PROCESS TO RESTART ON TERMINATION. oW AIT CAUSES INIT TO WAIT BEFORE CONTINUING oS YSINIT USED FOR INITIALIZING SYSTEM, MAY CHECK FOR DIRTINESS OF BOTH FILE SYSTEMS & ACTIVE SWAP PARTITIONS, AND SETS HOSTNAME. oI NITDEFAULT – SETS DEFAULT SYSTEM RUN LEVEL, E. G., 3 ( FULL MULTIUSER MODE ) H OW INIT CONTROLS THE SYTEM

21 11/19/2009 rwjBROOKDALE COMMUNITY COLLEGE21 C HAPTER 19 (P ART 2) T O B E C ONTINUED


Download ppt "Unix Comp-145 L ECTURE 9: I NTRODUCTION TO S YSTEM A DMINISTRATION S OURCE : S. D AS, “Y OUR U NIX : T HE ULTIMATE G UIDE ”, 2 ND E DITION, M C G RAW H."

Similar presentations


Ads by Google