CS 3750: Operating Systems I

Fall 2019 - Lab 2

Due October 24, 2019

This is an individual assignment. All work must be your own. You should not look at any other student's work (in whole or in part, on paper or on screen), nor allow anyone else to look at yours, during the course of this assignment.

Turn in your answers to these questions to Lab 2 in the CS Homework system. (Plain text or MS Word or PDF only). Typed.

This lab will introduce you to more about command line interaction with Unix operating systems. All answers to questions below must be command lines. Answers that solve the given problems using GUI (Graphical User Interface) tools will receive no points.

Hint: 'man' is your friend. "man UnixCommandName" will provide a helper manual on how to use any Unix command. (Type "man UnixCommandName" at a Unix command prompt. Tap the space bar to move down in the manual, 'b' to move back up, and 'q' when you are done reading the manual.)

Hint 2: Material learned by working on this lab exercise will, of course, show up on the next quiz.

I. Logging into the Unix system.

Open any UNIX-like terminal that you prefer. Recent versions of Apple's Mac OS are based on the Unix OS, so the 'Terminal' application available on any Mac in our department CS lab will be fine. Installing Cygwin on your own Windows machine could also give you a Unix-like environment on an otherwise Windows machine.

Type
which ssh
You should see the absolute path name of the 'ssh' command, if it is installed on the system you are using. You will need 'ssh', so if you see "Command not found", then move to a computer that has ssh installed.

II ssh, ls, chmod

Pretend you are a system administrator at a physically large facility. A user telephones you and says that they think their computer has been hacked, and malware files might be in their account. Your job is to help.

However, you are far away from the user's office, and you don't want the hacker (if they exist) to delete evidence of their invasion before you have time to walk across campus.

You must log in to the user's computer remotely and use Unix commands to investigate. You may select hopper.csustan.edu, turing.csustan.edu, or one of the other available servers in our lab. Here is a list of those servers, plus their 'fingerprints', which the computers will present to you when you try to log in for the first time, so you can verify your computer has connected to the correct machine before you type your password.

(One way to steal passwords is to persuade people they are logging in to a familiar, safe machine when they are not. Checking fingerprints is a way to prevent this theft from happening - or at least make the theft more difficult.)

Use your own CS student account to log in to a CS department server from the command line. You must NOT be sitting physically at the server when you do this. Sit at one machine in the CS lab and use a Terminal window to log in to a different one, or perform this task from your home computer.

The CS department server will be the "user's computer" in the following questions. Call it X.csustan.edu.

#1: Explain what you did, exactly, to log into the CS department server? Provide exact command lines that you used in your answer.

Now that you have logged in as yourself, log out. ("exit" at the command prompt)

Log in to X.csustan.edu from the command line again. This time, log in as "the user". The user's login and password are here.

#2: Explain what you did, exactly, to log into the CS department server as the user? Provide exact command lines that you used in your answer.

(Do not ever share your real password. Real sysadmins don't need your password; they have their own. This user account will be deleted after Lab 2 is turned in, so sharing its password in your report, if you must, is ok.)

Inside the "cs3750" folder in the user's account there is a folder named after your last name. (If your name has a hyphen or space in it, the folder is only the first half of your last name.)

Inside the folder named after you, there is a file, hidden by the hacker. Your task is to find that file and read its contents. (See hint at top of section.)

#3: Explain what you did, exactly, to find the file, and how you were able to see its contents? Provide exact command lines that you used in your answer. Also copy the contents of the file into your answer.

III Looking around: top, ps

You are worried that the hacker may have left a program running on the user's machine. You suspect that the hacker's potential malware will either be using a lot of CPU time, or have a lot of threads running within it. Or the hacker's program will have the word "wilsonfisk" in the process name.

Figure out how to list all running processes on a computer with 1) the most CPU active processes sorted to the top of the list, 2) the processes with the most threads sorted to the top of the list, or 3) only processes with "wilsonfisk" in their process names visible.

For the lists of CPU active processes and processes with many threads, bear in mind that some malware will not be active all the time, in order to hide better. So the commands you use to check for high CPU or thread usage should run continually, and update their information periodically. This would allow a system administrator to look for processes whose activity "spike" every once in a while.

Note that the hacker may not be using the same user identifier as you are; you will need to look at all the processes on the system. You might need to use commands you learned in Lab 1, too.

#4: Explain what you did, exactly, to list the most CPU active processes. Provide exact command lines that you used in your answer.

#5: Explain what you did, exactly, to list the processes with the most threads. Provide exact command lines that you used in your answer.

#6: Explain what you did, exactly, to list only the proceeses with "wilsonfisk" in their process names. Provide exact command lines that you used in your answer.

IV Looking around some more: du, grep

You suspect that the hacker left behind a suspicious file in the user's home directory. However, you don't know the name of the file and, obviously, the hacker would not have put it somewhere obvious. You do suspect the file will be significantly larger (bigger file size) than anything else in the user's cs3750 folder.

Log in as the user, and Use 'cd' to get into the cs3750 folder.

Using one of the Unix commands identified in this subsection title, take a look at the sizes of the data stored in all the folders in this folder. (This can be done with one Unix command. Discover it.) One folder will be much larger than the rest -- that is where the hacker left a suspicious file.

#7: Explain what you did, exactly, to find the file? Provide exact command lines that you used in your answer. Also identify the location of the file, its name, and how many bytes are in the file in your answer.

(If you are unable to find the file using a command line command, you may contact the professor to find out its location and complete #8.)

#8: Explain what you did, exactly, to find the word "wilsonfisk" within the file. Provide exact command lines that you used in your answer. Also include the contents of the line or lines within the file that contain the word "wilsonfisk".

(Note: The file is a real one, of email messages. However, most of the email addresses and human names in the file were changed.)

Turn in your answers to the questions in Lab 2 in the CS Homework system.