IT3110 - System Automation

IT3110 @ utahtech

Python

For this assignment, you will utilize Python to automate a series of tasks.

Description

If you login to the ssh server and execute the who command, you can quickly see who is logged in. If you choose one of those logins and issue the groups command prior to the login id, you will see what groups the user is a member of (i.e. groups d00001234).

As a system administrator, you want to be able to run a python script and collect various information from a remote machine.

Here are some various runs of my script:

    joe@yavin:~/s23/it3110/scripts/python$ python3 get_user_info.py
    usage: get_user_info.py [-h] [-u USER] -o {1,2,3}
    get_user_info.py: error: the following arguments are required: -o
    joe@yavin:~/s23/it3110/scripts/python$ python3 get_user_info.py -o 0
    usage: get_user_info.py [-h] [-u USER] -o {1,2,3}
    get_user_info.py: error: argument -o: invalid choice: '0' (choose from '1', '2', '3')
    joe@yavin:~/s23/it3110/scripts/python$ python3 get_user_info.py -o 1
       The sorted users:
               d00147808
               d00147808
               d00293846
               d00353644
               d00368962
               d00419669
               d00483737
               d00498305
    joe@yavin:~/s23/it3110/scripts/python$ python3 get_user_info.py -o 2
    		The process       sshd, is being ran by 12 users
    		The process       bash, is being ran by 8 users
    		The process        ssh, is being ran by 4 users
    		The process       ping, is being ran by 1 users
    		The process  gpg-agent, is being ran by 1 users
    		The process  ssh-agent, is being ran by 1 users
    joe@yavin:~/s23/it3110/scripts/python$ python3 get_user_info.py -o 3 -u d00419663
    The user is  d00419663
    IDK when that user last logged in
    joe@yavin:~/s23/it3110/scripts/python$ python3 get_user_info.py -o 3 -u d00419669
    The user is  d00419669
    The user d00419669 logged in at 15:41 

You can choose what your script does but it must at a minimum:

To submit

A document that outlines what your script does and how it simplifies a system administration task for you. It should perform a non-trivial function and something that is useful to a system administrator.