System Administration HW3 - Shell Script chenyp. Computer Center, CS, NCTU 2 Requirements  File statistics (20%+10%) use one-line command to show files.

Slides:



Advertisements
Similar presentations
Jump to first page Unix Commands Monica Stoica Jump to first page Introduction to Unix n Unix was born in 1969 at Bell Laboratories, a research subdivision.
Advertisements

System Administration Final Project - Micro Computer Center hchung, hwchiu.
Chapter 21 Security. Computer Center, CS, NCTU 2 Firewall (1)  Using ipfw 1.Add these options in kernel configuration file and recompile the kernel 2.Edit.
Introduction to Course Content. Computer Center, CS, NCTU 2 Outline  What SA Should do.  What You can expect to learn from this course.  What attitude.
UNIX Chapter 00 A “ Quick Start ” into UNIX Operating System Mr. Mohammad Smirat.
Guide To UNIX Using Linux Third Edition
Lecture 01CS311 – Operating Systems 1 1 CS311 – Lecture 01 Outline Course introduction Setting up your system Logging onto the servers at OSU with ssh.
Lecture 02CS311 – Operating Systems 1 1 CS311 – Lecture 02 Outline UNIX/Linux features – Redirection – pipes – Terminating a command – Running program.
System Administration HW1-1 changlp. Computer Center, CS, NCTU 2 Requirements  Basic Install up-to-date –RELEASE of FreeBSD  8.2-R Add a user and a.
BILKENT UNIVERSITY DEPARTMENT OF COMPUTER TECHNOLOGY AND INFORMATION SYSTEMS CTIS156 INFORMATION TECHNOLOGIES II CHAPTER 10: ADVANCED FILE PROCESSING.
Va-scanCopyright 2002, Marchany Unit 6 – Solaris File Security Randy Marchany VA Tech Computing Center.
Help session: Unix basics Keith 9/9/2011. Login in Unix lab  User name: ug0xx Password: ece321 (initial)  The password will not be displayed on the.
The file structure and related utilities CS240 Computer Science II.
System Administration HW2 - FTP, Samba, BT, ZFS jwbai.
Final Project – NFS and NIS jwbai. Computer Center, CS, NCTU 2 Goal master.passwd passwd group netgroup amd.conf userA, /nis/home/userA userB, /nis/home/userB.
Agenda User Profile File (.profile) –Keyword Shell Variables Linux (Unix) filters –Purpose –Commands: grep, sort, awk cut, tr, wc, spell.
Chapter Four UNIX File Processing. 2 Lesson A Extracting Information from Files.
The UNIX Shell. The Shell Program that constantly runs at terminal after a user has logged in. Prompts the user and waits for user input. Interprets command.
AN INTRO TO UNIX/LINUX COMMANDS BY: JIAYANG WANG.
FTP Server and FTP Commands By Nanda Ganesan, Ph.D. © Nanda Ganesan, All Rights Reserved.
System Administration Introduction to Unix Session 2 – Fri 02 Nov 2007 Reference:  chapter 1, The Unix Programming Environment, Kernighan & Pike, ISBN.
Additional UNIX Commands. 222 Lecture Overview  Multiple commands and job control  More useful UNIX utilities.
Session 2 Wharton Summer Tech Camp Basic Unix. Agenda Cover basic UNIX commands and useful functions.
Introduction to Bash Programming Ellen Zhang. Previous three classes What have we learnt so far ?
Shell Programming Any command or a sequence of UNIX commands stored in a text file is called a shell program. It is common to call this file a command.
System Administration HW3 Shell Script changlp. Computer Center, CS, NCTU 2 Requirements  User socket statistic (20%) Use one-line command to show per-user.
Agenda Link of the week Use of Virtual Machine Review week one lab assignment This week’s expected outcomes Review next lab assignments Break Out Problems.
BIF713 Basic Unix/Linux Commands Getting Help with Commands.
System Administration HW2 Shell Script xclin. Computer Center, CS, NCTU 2 Requirements  Xferlog statistics (15%) use one-line command to show FTP transfer.
System Administration Practice Homework 1-2 : X Window System lctseng.
Log-in to the Unix Server A successful log-in allows access to the server through the Secure Shell. SSH, also known as Secure Shocket Shell, is a Unix.
Homework 03 - Hint DNS. Computer Center, CS, NCTU 2 Architecture ns.a.nctucs.net a.a /24 ns.b.nctucs.net b.b /24.
Homework 03 DNS. Computer Center, CS, NCTU 2 Architecture ns.a.nctucs.net a.a /24 ns.b.nctucs.net b.b /24 slave.
System Administration HW2 - File System Server ylin.
Internet & World Wide Web How to Program, 5/e © by Pearson Education, Inc. All Rights Reserved.
System Administration HW2 - File System Server. Computer Center, CS, NCTU 2 FTP  Install a FTP server for FreeBSD Pure-FTPd: /usr/ports/ftp/pure-ftpd.
E X C E E D I N G E X P E C T A T I O N S Basic LINUX Linux System Administration Dr. Hoganson Kennesaw State University Operating Systems Directory structure:
ULI101 More Linux Commands Introduction to UNIX/Linux and the Internet
Week 9 - Nov 7, Week 9 Agenda I/O redirection I/O redirection pipe pipe tee tee.
Exercise 1 Introduction to C# CIS Code the C# program to prompt the user to key in 12 integer values from the keyboard. If a value containing.
Shell Control Statements and More
Lesson 13 Databases Unit 2—Using the Computer. Computer Concepts BASICS - 22 Objectives Define the purpose and function of database software. Identify.
System Administration HW5 - Micro Computer Center yihshih / lctseng.
CS 245 – Part 1 Using Operating Systems and Networks for Programmers Jiang Guo Dept. of Computer Science California State University Los Angeles.
Introduction to SAS/willow (Unix) Sam Gordji Weir 107.
System Administration Practice Homework6 - LDAP login + Puppet + Jail yench / lctseng / chchang2222.
Isecur1ty training center Presented by : Eng. Mohammad Khreesha.
FTP COMMANDS OBJECTIVES. General overview. Introduction to FTP server. Types of FTP users. FTP commands examples. FTP commands in action (example of use).
Lecture 02 File and File system. Topics Describe the layout of a Linux file system Display and set paths Describe the most important files, including.
A Brief Overview of Unix Brandon Bohrer. Topics What is Unix? – Quick introduction Documentation – Where to get it, how to use it Text Editors – Know.
 Last lesson, the Windows Operating System was discussed along with the Windows command shell  Unix is a computer operating system, that similarly manages.
The Unix File sytem. Introduction Tree structure …
CS 403: Programming Languages Lecture 20 Fall 2003 Department of Computer Science University of Alabama Joel Jones.
File Management commands cat Cat command cat cal.txt cat command displays the contents of a file here cal.txt on screen (or standard out).
Batch Files More flow of control Copyright © by Curt Hill.
System Administration Practice Homework 1-3 : Chinese World lctseng.
Network administration HW3 吳宗翰 wutzh. Computer Center, CS, NCTU 2 Architecture.
System Administration HW3 - Shell Script hchung. Computer Center, CS, NCTU 2 Requirements  User connect time statistic script (10%) Use one-line command.
Introduction to the Linux Commandline
System Administration Practice Homework 2: Shell Programming
Homework 3 frank.
System Administration Practice Homework 1-1 : FreeBSD Base
Presented by, Mr. Satish Pise
Chapter Four UNIX File Processing.
Final Project– NFS and NIS
Tutorial Unix Command & Makefile CIS 5027
Compute System Administration Homework 2: Shell Script
System Administration HW3 - File System Server
Network Administration Homework 1
System Administration HW2 - File System Server
Presentation transcript:

System Administration HW3 - Shell Script chenyp

Computer Center, CS, NCTU 2 Requirements  File statistics (20%+10%) use one-line command to show files statistics Bonus(10%)  script (20%) Write a shell script to parse log.  A simple search platform (60%)

Computer Center, CS, NCTU 3 File statistics  Use one-line command to show File statistics.  Print the sum of files’ size in the directory, find the largest and the smallest files, and print its filenames, filesizes and owners. (not include subdirectories)  All commands should be concatenated using "|"(pipe) in one line.  Can not create temporary file.  If the number of the largest or the smallest is more than one, choose the last one.  No “&&” “||” “>” “>>” “<“.

Computer Center, CS, NCTU 4 File statistics  Examples:  % ls –l  -rw-r--r-- 1 chenyp gcs 720 Nov 14 18:25 test  -rw-r--r-- 1 chenyp gcs 720 Nov 14 16:55 test_a  -rw-r--r-- 1 chenyp gcs 378 Nov 10 17:12 test_b  -rw-r--r-- 1 chenyp gcs 397 Nov 13 16:59 test_c  -rw-r--r-- 1 chenyp gcs 536 Nov 12 17:43 test_d  -rw-r--r-- 1 chenyp gcs 191 Nov 14 17:25 test_e  %./hw3_1.sh  Bonus(10%) If you can do it with subdirectories, you will get extra 10% Max: test_a 720 chenyp Min: test_e 191 chenyp

Computer Center, CS, NCTU 5 script  Write a script to parse log for ssh bruteforce.  Print the IP address and times descending.  Syntax Parserlog.sh [-n number] –f file -n  Show the most Nth times and its ip address.  If n is none, show all and sorted by times descending. -f  Log file  Sample file: –

Computer Center, CS, NCTU 6 script  SSH bruteforce Only parse these three formats Nov 15 13:53:32 NASA sshd[12397]: Invalid user supporte from Nov 15 13:53:35 NASA sshd[12399]: Invalid user soporte from Nov 15 21:45:25 NASA sshd[16601]: error: PAM: authentication error for root from Nov 15 22:00:36 NASA sshd[16765]: error: PAM: authentication error for root from Nov 15 22:16:40 NASA sshd[16868]: error: PAM: authentication error for root from Nov 15 22:31:59 NASA sshd[16964]: error: PAM: authentication error for root from Nov 15 22:47:22 NASA sshd[17129]: error: PAM: authentication error for root from Nov 15 16:28:15 bsd1 sshd[6587]: error: PAM: authentication error for illegal user onlyeric23 from  Example % Parserlog.sh –n 3 –f /tmp/logfile times times times times times times

Computer Center, CS, NCTU 7 A simple search platform  Write a user-friendly search platform by using dialog(1)  First, you should show a welcome message.

Computer Center, CS, NCTU 8 A simple search platform  Second, you should use menubox for client to choose which service to provide.

Computer Center, CS, NCTU 9 A simple search platform  Basic search: Input a keyword. Go to the wiki and show the first introduction for the keyword.

Computer Center, CS, NCTU 10 A simple search platform  Advanced search: Input a keyword. Show the content for the keyword and use checklist to choose which information to display.

Computer Center, CS, NCTU 11 A simple search platform  Mergedata Input a keyword. Show the content for the keyword and use checklist to choose which information to merge. You should merge files to the wikimerge/keyword.tar.bz2 The keyword.tar.bz2 contains the files client chosen. Java.tar.bz2 contains  geography.txt  history.txt  Notes.txt  Externel_links.txt

Computer Center, CS, NCTU 12 A simple search platform  Show mergedata First, you should display which files in the wikimerge/ and use menubox for client to choose. And show all the content in the keyword.tar.bz2. Example:  You should display the content of the –geography.txt –history.txt –Notes.txt –Externel_links.txt  If you choose the java.tar.bz2.

Computer Center, CS, NCTU 13 Help  IRC channel #nctuNASA on freenode  Newsgroup cs.course.sysadmin  BBS bs2.to board CS-SysAdmin   Goto CSCC to ask professional 3F!