+ All Categories
Home > Documents > System Administration. Logging in as System Administrator System Admin login (aka superuser, aka...

System Administration. Logging in as System Administrator System Admin login (aka superuser, aka...

Date post: 06-Jan-2018
Category:
Upload: miranda-lane
View: 223 times
Download: 1 times
Share this document with a friend
Description:
Acquiring Superuser Privileges System adminstrator can acquire superuser privileges without using root login id by using su command: $ su – Password: ******** # Including - after su assures same environment as root. Omitting - after su assures environment of user account from which su is executed, e.g., user’s home directory su is also used by non-privileged users to become the superuser $ su – rbournique # need user login id To exit su mode, type exit or ctl-D
16
System Administration
Transcript
Page 1: System Administration. Logging in as System Administrator System Admin login (aka superuser, aka root) –login id: root –Default PS1 prompt: # –Home directory:

System Administration

Page 2: System Administration. Logging in as System Administrator System Admin login (aka superuser, aka root) –login id: root –Default PS1 prompt: # –Home directory:

Logging in as System Administrator

• System Admin login (aka superuser , aka root)– login id: root– Default PS1 prompt: #– Home directory: /

• When root changes its password, no prompt for exiting password.• Root’s value for PATH

– Never includes the current directory– Only includes /sbin or /user/sbin or both

• /sbin contains most administrative commands

Page 3: System Administration. Logging in as System Administrator System Admin login (aka superuser, aka root) –login id: root –Default PS1 prompt: # –Home directory:

Acquiring Superuser Privileges• System adminstrator can acquire superuser privileges without using root login id by using su command:

$ su –Password: ********#

• Including - after su assures same environment as root.• Omitting - after su assures environment of user account from which su is executed, e.g., user’s home directory• su is also used by non-privileged users to become the superuser

$ su – rbournique # need user login id• To exit su mode, type exit or ctl-D

Page 4: System Administration. Logging in as System Administrator System Admin login (aka superuser, aka root) –login id: root –Default PS1 prompt: # –Home directory:

• Add users and manage groups, e.g. change a user’s password• Monitor and control system startup (boot) and shutdown• Monitor and control the performance of system resources, e.g.

Change the contents/ attributes of files, delete files, limit file sizes Initiate or kill any process except those necessary to run UNIX

Control user access to scheduling services like at and cron Control access to networking services like ftp and remote login

• Perform backups (and restores) of critical files and data.• Set or reset system clock• Use wall command to broadcast messages to all users

Kinds of Activities System Administrators Do

Page 5: System Administration. Logging in as System Administrator System Admin login (aka superuser, aka root) –login id: root –Default PS1 prompt: # –Home directory:

How System Administrators Do Their Job

• System administrators are super script writers !!• Scripts are used to:

• Search through event and error logs• Do nightly backup of drives and create archives• Initiate scheduled maintenance• Monitor CPU, network status• Monitor free disk space

• crontab used to schedule administrative scripts

Page 6: System Administration. Logging in as System Administrator System Admin login (aka superuser, aka root) –login id: root –Default PS1 prompt: # –Home directory:

• A group is a set of users having a separate set of privileges.• Every user has a primary group and 1 or more supplementary groups.• Commands for group are groupadd, groupdel and groupmod• These commands edit entries in the file /etc/group

GroupName:Passwd:GID_Num:GrpMemberLst1st field: name of the group2nd field: generally not used3rd field: group number4th field: all users for whom this group is

supplementary Example: staff::1: Group staff is group 1 and has no

supplementary users in it.

Managing Groups

Page 7: System Administration. Logging in as System Administrator System Admin login (aka superuser, aka root) –login id: root –Default PS1 prompt: # –Home directory:

Commands for managing users are useradd, userdel and usermod

These commands edit entries in the file /etc/passwd UserName:Passwd:NumID:NumGID:Comment:HomeDir:Shell

1st field: name of the user2nd field: usually X, generally not used (shadow passwords)3rd field: numeric user ID4th field: numeric group ID (primary group)5th field: comment field (aka GCOS field)6th field: user’s home directory7th field: user’s default shell

Example: rick:x:17:1:Bournique:/home/rick:/bin/sh

Managing Users

Page 8: System Administration. Logging in as System Administrator System Admin login (aka superuser, aka root) –login id: root –Default PS1 prompt: # –Home directory:

• Adding a User $ useradd –u 17 –g staff -c “Bournique” –d /home/rick –s /bin/sh –m rick

• Deleting a User userdel [-r] rick

• Modifying a User’s Password Entry usermod [-c comment] [-d home dir ] [-e expire date]

[-g group] [-l login] [-p passwd] [-s shell] [-u uid] rick

User Command Usage

Page 9: System Administration. Logging in as System Administrator System Admin login (aka superuser, aka root) –login id: root –Default PS1 prompt: # –Home directory:

• System state of UNIX is determined by its run level:0 System shutdown 1 System Admin mode (local file system mounted)2 Multi-user mode (NFS not available)3 Full multiuser mode5 Graphical environment mode in Linux6 Shutdown and reboot modes /S Single user mode (file system mounted).

At each level, a distinct set of processes, scheduled to run.• The init process controls the way UNIX is booted & powered down.

On boot, init run level moves to 1 or s On shutdown, init run level moves to 0 or 6

UNIX Run Levels

Page 10: System Administration. Logging in as System Administrator System Admin login (aka superuser, aka root) –login id: root –Default PS1 prompt: # –Home directory:

• init takes all its instructions from /etc/inittab file• /etc/inittab contains instructions for what programs to run in

each run level• System administrator maintains /etc/inittab, e.g., insert entries

for adding a new terminal to the system• Administrator also issues shutdown command:

issues wall to announce shutdown order to logoff sleeps for 1 minute sends signals to processes for normal termination logs off remaining users and kills processes unmounts all secondary file systems issues sync to write memory-resident data to disk

Monitoring Start Up and Shutdown

Page 11: System Administration. Logging in as System Administrator System Admin login (aka superuser, aka root) –login id: root –Default PS1 prompt: # –Home directory:

System Resources That Need Performance Monitored

• CPU Utilization (monitoring fair allocation of time slices)• Memory Utilization (context switching /swapping time and frequency)• Disk space Usage• I/O Time (amount of time spent moving data and • servicing I/O requests)• Network Usage Time• Application Program Usage

Page 12: System Administration. Logging in as System Administrator System Admin login (aka superuser, aka root) –login id: root –Default PS1 prompt: # –Home directory:

Some UNIX Performance Monitoring Commands

ps -display processes running in the system cron -perform process scheduling fsck -file system consistency check netstat -display network statistics nfsstat -display network file system (NFS) statistics time -display process’ CPU utilization df -display disk free report uptime -display system load average iostat -display input and output statistics vmstat -display memory, CPU, disk utilization reports

Page 13: System Administration. Logging in as System Administrator System Admin login (aka superuser, aka root) –login id: root –Default PS1 prompt: # –Home directory:

uptime: Report System Load Average

# uptime 12:04am up 215 day(s), 8:37, 2 users, load average 0.11, 0.10, 0.12

Translation: Current time is 12:04 am, system has been up 215 days since 8:37; there are 2 users; five minutes ago load average was 0.11, ten minutes ago was 0.10 and fifteen minutes ago was 0.12.

Page 14: System Administration. Logging in as System Administrator System Admin login (aka superuser, aka root) –login id: root –Default PS1 prompt: # –Home directory:

vmstat: Virtual Memory Statistics General form: vmstat interval number Example: Show memory stats in 5 second intervals , 3 times# vmstat 5 3procs memory page disk faults cpur b w swap free re mf pi po fr de sr s0 s1 s2 s6 in sy cs us sy id0 0 0 133136 13400 0 66 14 0 0 0 0 1 7 1 0 194 650 124 3 3 94

#

procs (Processes) r Number of run-able processes during the interval. (excludes processes

waiting or in I/O) b Number of processes that are blocked waiting for I/O or other event. w Number of processes that are swapped out. A non zero value means

system was swapping

Page 15: System Administration. Logging in as System Administrator System Admin login (aka superuser, aka root) –login id: root –Default PS1 prompt: # –Home directory:

vmstat: Virtual Memory Statistics continuedmemory swap used swap space free available free swap space page pi 1 kb pages per second that have been paged in po 1 kb pages per second that have been paged out de anticipated short term memory shortfalldisk s0, … number of disk operations per second on each disk drivefaults in device interrupts per interval sy system calls per intervalcpu cs CPU context switch rate us percentage of total CPU time spent in user state sy total CPU time spent in system state id percentage of total CPU time that CPU is idle

Page 16: System Administration. Logging in as System Administrator System Admin login (aka superuser, aka root) –login id: root –Default PS1 prompt: # –Home directory:

iostat: Disk Activity StatisticsGeneral Form: iostat [<drives>] <interval> [<#samples>]

Example: To have iostat show stats for all drives in 2 second intervals: # iostat 2 device bps sps msps c1t6d0 0 0.0 1.0 c1t3d0 0 0.0 1.0 #

bps Average number of kilobytes per second during previous interval for disk. sps Average number of seconds per seek. msps Average number of milliseconds per seek.


Recommended