Course Info / Syllabus

Labs

Lecture Topics

Exam Reviews

Source Code & Other Resources


Operating Systems Concepts & Design

Lab 11 - tar, sftp, and ssh

Lab Procedure

Make sure to return to the AWS Learner Lab page (link in Pilot if you forgot to bookmark it) and hit “Start Lab” to turn on your sandbox / AWS instance.

Use ssh to connect to your AWS Ubuntu instance.

Go to the folder that contains your repository (likely named ceg2350-yourgithubusername).

Create a new directory, Lab11.

Create a file named README.md in the Lab11 folder. The Lab 11 Template can be copied from this link:

You may refer to additional resources outside of the recommended resources provided.

Any resource that you use that contributes to your understanding of exercises in this lab should be cited in the Citations section of your lab answers. To add citations, provide the site and a summary of what it assisted you with. If generative AI was used, include which generative AI system was used and what prompt(s) you fed it.

If you make mistakes with commands in the lab, note them! Writing down what went wrong and what the correction was will significantly help your learning journey. If you cannot find a correction, it will help the TAs or myself understand what point you reached and determine some potential solutions.

Part 0 - branch control

Determine and create one or more GitHub Issues for this lab.

Determine and create one or more branches to resolve the Issues for this lab.

In the end, your lab submission (README.md) should be visible on the main branch.

Part 1 - tar it up

With the semester wrapping up, it’s time to prepare to lose access to your instances. Identify folders of work on your AWS instance you would like to save. If you have none, use the folder that contains your local copy of your GitHub repository. While using GitHub to save work is an option, it is just as common to need to compress and transfer information. It is not required, but is interesting to look the the size of these folders pre and post compression

Do the following on your AWS instance.

Useful commands: tar, gzip, file

  1. For the tar command, fill in the table describing the most frequently used flags:
tar Option Description
-c  
-v  
-f  
-z  
-x  
-t  
  1. tar and compress folders of your choice using gzip compression. Write the command you used.

Do NOT add and commit your tar and compressed file to GitHub. It does not need to be in your repository folder and may in fact be too large to push to GitHub.

  1. Determine at least one method to confirm your tar and compressed file is a tar and compressed file. Just stating it has a .tar.gz extension will not be sufficient for credit.

Resources

Part 2 - SFTP

  1. For the sftp command, fill in the table describing the most frequently used commands within the program:
sftp Command Description
ls  
lls  
cd  
lcd  
pwd  
lpwd  
put  
get  
exit / bye  

Confirm you are on your local system using the terminal you normally use to ssh to your instance. Do not ssh to your instance

  1. Connect to your AWS instance via sftp.
  2. Retrieve the tar and compressed file (ending with .tar.gz) from your AWS instance and download it to your local system
  3. Decompress & extract the file (.tar.gz) to a folder on your system
    • You can remove it after you get the command right, I’m not a space hog

Resources

Part 3 - Extract & Profit

For this part, you will be installing an open source web server to your AWS instance, extracting a compressed archive containing a static website, and testing that it works!

Do the following on your AWS instance.

  1. Install apache2 or nginx with apt
  2. Confirm that your chosen web serving service is running
  3. Download simple-site.tar.gz to your AWS instance
  4. Change the permissions for /var/www/html:
    • For the /var/www/html folder - the owner can read, edit, and view (execute) the directory; members of the group can read, edit, and view (execute) the directory; others on the system can only read and view (execute) the directory.
    • For the files in the folder - your user is the owner and primary group, your user (and members of your group) can read and write, and others can only read. Ensure the next steps also utilize these permissions.
  5. Extract the compressed archive to /var/www/html
  6. Edit the index.html file in /var/www/html with:
    • your name where YOUR LAST NAME HERE is. Make this div visible
    • replace Insert something fun here with a fact about you
<section>
         <h2>CEG 2350 Lab 11</h2>
         <div style="display:none">YOUR NAME HERE</div>
         <h3>Facts about me</h3>
         <p>Insert something fun here</p>
         
</section>

When you use ssh, you specify a hostname after the @ sign. Typically a hostname is a pretty name the associates with the IP address of the server. We do not have a pretty name set up for your AWS instances, so the only way to address them is by their public IP address (as you’ve been doing all semester).

  1. Open a browser on your local system (can’t do it in AWS 😜). Type your AWS instance’s public IP into the URL bar. If your page shows, take a screenshot with the URL bar included.
    • Note: you may need to explicitly type http:// in front of your AWS instance’s public IP. We’ll talk about it later.
    • Note: If you changed index.html and aren’t seeing your changes in your browser, try to use your browsers hard reload, often ctrl+shift+r or ctrl+f5. This will get the actual file from the server and ensure its not an old cached version.

Resources

Part 4 - ssh keys

Without practice, ssh connections and authentication just seem like magic. Really, it is all about files and information being in the right spot as defined in rules in configuration files. The goal of this part is to practice where keys go when you have a new ssh keypair. This is a common task to do when you gain access to a system - put your public key in the authorized_keys file in the .ssh folder of your remote account, then connect from your system to the remote system’s account.

When you see a reference to local system, this means your system - not your AWS instance

  1. Fill in the following table of commonly configured ssh files:
ssh File Path / Name Purpose
~/.ssh/config  
~/.ssh/id_rsa  
~/.ssh/id_rsa.pub  
~/.ssh/id_ed25519  
~/.ssh/id_ed25519.pub  
~/.ssh/authorized_keys  
~/.ssh/known_hosts  
  1. Fill in the following table of options commonly used in a config file for ssh:
ssh config Option Description
Host  
HostName  
User  
Port  
IdentityFile  
  1. On your local system, make a new key pair - with a non-default name. Change at minimum the default name
  2. On your AWS instance, create a user & user home directory or use the your firstinitiallastname account
  3. Put the public key of the key pair you created in the AWS instnace user’s ~/.ssh/authorized_keys file on the AWS instance
  4. From your local system, ssh in to the AWS instance using the user’s username and the private key of the keypair you created.
    • Format reminder: ssh -i path/to/privatekey username@hostname_or_ip
  5. Write an entry in your local system’s ~/.ssh/config file with the new connection information.
  6. Write the ssh command that will use your config file information if correctly entered.

Resources

Submission

  1. Verify that your GitHub repo has a Lab11 folder with at minimum:

    • README.md
  2. In the Pilot Dropbox, paste the URL to the Lab11 folder in your GitHub repo

    • URL should look like: https://github.com/WSU-kduncan/ceg2350-YOURGITHUBUSERNAME/tree/main/Lab11

Rubric

Your files should be cleanly presented in your GitHub repository. Citations should be included as needed. Include which generative AI system was used and what prompts were used if generative AI was used.

Rubric