CS197U: A Hands-on Introduction to Unix

Assignment 3

In this assignment you will setup an Ubuntu Virtual Machine, and do some basic system administration. If you have any questions, or run into any bugs, please email me!

Part 1: Creating a Virtual Machine (2 pts)

Follow the instructions for Setting up an Ubuntu VM.

Log into your new virtual machine and execute the following commands in sequence:

1. Open a terminal window and create a directory called assign-3 inside your home directory.

2. Change into the new directory assign-3.

3. Type wget https://people.cs.umass.edu/~tian/answers-3.txt
This will download a file from the course website into the current directory.

4. Type gedit answers-3.txt & to open the answers-3.txt file in the text editor.

5. Answer parts 0, 1A and 1B

The remaining parts of the assignment will ask you questions which you should answer in the appropriate sections of the answers-3.txt file. The questions will indicate whether you should write just the command required to answer the question, or the command plus its full output.

Part 2: Learning About Your System (6 pts)

2.A) Installing Applications

First you must install the package build-essential from the command line using the apt-get program. This will install a C++ compiler and some other useful things for you. Read about apt-get here.

What is the full command used to install the ''build-essential'' package? (Command only)

Next, install Ubuntu’s graphical package management systemsynaptic through the command line. Start the synaptic either through command line using sudo or by searching in the launcher. Then install a second application using synaptic with the following steps: (1) Look through the list of available packages (it is very long!), and pick an application which sounds interesting to you. You can narrow the search by selecting a category in the left part of the window. (2) Right click a package to mark it for installation, and press Apply to complete the install process.

What application did you install and what does it do?

2.B) System Information

Try and use some commands to learn about your Ubuntu system. Write both the command and the output into your text file.

What kernel release version is your VM running? (Command and output)
Hint: Your kernel version should be something like: 3.19.??-??

What hard disks are connected to your system and how much space is available in them? (Command and output)
(you can show the full output from the second command, you do not need to interpret it)

2.C) /proc/ Filesystem

We also described how /proc/ holds a number of special files whose contents are changed dynamically by the operating system. Some of these files can be easily read by running cat /proc/FILE. For example, cat /proc/crypto prints out a list of all cryptography libraries currently loaded by the operating system. You can learn more about the /proc/ file system here.

Display the /proc file which tells how much memory is installed on the system (Command and output)

Display the /proc file which tells the CPU speed of the system (Command and output)
(You don't have to copy the full output -- just the first few lines is fine)

Part 3: Administering the System (2 pts)

3.A) Creating a New User

Suppose in your current Ubuntu VM, you set your username to be USERNAME. Create a new user with NEWUSERNAME by following these instructions. You can use either the graphical or command line based approach (but read about both).

3.B) File Permissions

Open two terminal windows and run the following commands. The label W1 indicates commands that should be run in the first window, and W2 is for commands in the second window.

1. W1: type man su to learn what the su command does.
2. W1: type su NEWUSERNAME to become the new user you created above (fill in the correct name).
3. W2: type su USERNAME to become the original user (it's OK if you already are!).
4. W1: type vim /home/NEWUSERNAME/myfile to create a new file, and write a few lines into it. Save and exit vim.
5. W2: type vim /home/NEWUSERNAME/myfile - are you able to modify AND save the file? Why?
6. W2: type sudo vim /home/NEWUSERNAME/myfile - now are you able to save the file? Why?
7. W1: type sudo vim /home/USERNAME/myfile - What happens now?

Write your responses to the questions in your answers-3.txt file.

How to Submit?

To submit the assignment, you must copy the file answers-3.txt from the Ubuntu VM back to your Edlab course home directory.

IMPORTANT: First, be sure to SAVE your answers-3.txt file!

(1) In a terminal, change into the directory with your answers-3.txt file

(2) Type (changing EDLABUSER to your edlab username)

scp answers-3.txt EDLABUSER@elnux7.cs.umass.edu:/courses/cs100/cs197u/EDLABUSER

This will copy the file from the VM to the elnux7 server. You will need to enter your Edlab password, and you may need to press y to authenticate the server if it is the first time you have connected to it. You can read more about ssh and scp here.

3) You can check that your file has been submitted by logging on to an Edlab machine and checking that the file exists in your course home directory. I will collect the file from there.