cs476-a1

CS476/576

Assignment #1

Due Midnight, Wednesday Oct 12, 2011


Write a script (any shell, perl, etc. ) with the following descriptions:

NAME

loginfo  -    login information for UNIX users.

 

SYNOPSIS

loginfo   <group_name or login_name>

DESCRIPTION

This script generates information about group of users (e.g., faculty) or a single user (e.g., wahab).

 

ü The information about a group member  is:

 

·        Tot: Total number of login to fast hosts

·        Max:  The maximum number an IP is used to login fast machines.

·        MIP:  The most used IP to login fast machines.

·        User Login

·        User Name

 

The information for members of a group is sorted by the value of Tot (highest to lowest).

 

ü The information about a single user is:

 

·        User Login

·        User Name

·        Group name

·        Tot: Total number of login to fast hosts

·        A list of <N, IP>   N is number of times an IP used to login  fast machines.

The list is sorted by N (highest to lowest).

 

 

DETAILS

 

ê Unix  group  file  (produced by the command  % ypcat group) lists the various Unix groups names and their assigned group numbers. For example, at the CS dept at ODU the output contains:

 

student:*:21:

faculty:*:13:

grad:*:22:

staff:*:10:

guest:*:31:

office:*:155:

 

ê Unix  password file (produced by the command  % ypcat passwd) have one line for each user. For example, at the CS dept at ODU the output contains of some members of the above groups are:

 

thristov:JPSijeRq455jB82:783:21:tihomir hristov:/home/thristov:/usr/local/bin/tcsh

wahab:stg/i.0xxJ1z55U:51:13:Hussein Abdel-Wahab:/home/wahab:/usr/local/bin/tcsh

hshi:h8fj6/06qH567Smg:189:22:Hui Shi:/home/hshi:/usr/local/bin/tcsh

robin_c:l5zLZCKU786TmFNw:15:10:Chris Robinson:/home/robin_c:/bin/bash

tisenhou://PGVHc7vi879lI:1470:31:tom isenhour:/home/tisenhou:/usr/local/bin/tcsh

cjanka://DuY0gAUkbfdsog:1488:155:Cathryn Janka:/home/cjanka:/usr/local/bin/tcsh

 

ê The department fast machines  may be displayed using  the command

% host fast

 

ê You may use the commands ssh and last to find the detailed information of fast machine recenent logins.

For example to find the details of user wahab logins information at fast host cappella:

% ssh capella last wahab   

 

ê To avoid typing your password when using  ssh  on  fast hosts  use the following shell script:

% /home/cs476/sshLogin.csh

 

v Sample data and output

 

ü List of groups sizes: allGroups.txt  

The highest 3 are:

37   :  faculty

167  :  grad

     2500 :  student

 

ü Sample output for: /home/cs476/fall11/a1/sampleOutput.txt

wahab (user only) 

cs476 (both user and group)  

staff (group only)  

 

 

ü Sample output for group sizes 5 to 50: /home/cs476/fall11/a1/groupSizes_5_50.txt  

5   :  staff

6   :  office

6   :  rfac

18  :  systems

20  :  xsystems

21  :  guest

35  :  acm

37  :  faculty