CSC 161 Grinnell College Spring, 2012
 
Imperative Problem Solving and Data Structures
 
 

Basic Linux Commands and Capabilities — 3

Abstract

This laboratory exercise continues the previous lab to discuss more Linux utilities and prepare you for compiling with the robots.

Introduction

This lab continues work with the following basic capabilities and commands.

Topic Category Subtopics Linux Commands
Permissions user, group, world ls -l
setting permissions chmod

Before progressing further in this lab, be sure you have completed the readings for this lab.

The Terminal Window

As with the previous lab, most work for this lab involves experimentation with a terminal window.

Directory and File Permissions

The following steps ask you to review the permissions for your account directories and adjust them for this course.

  1. Move to your home directory and obtain a "long" listing of the files present using the commands:

       cd
       ls -l
    

    (The cd command without parameters takes you to your home directory.)

    Interpret the meaning of each part of the directory and file listings.

Setting Permissions

For CSC 161, it seems likely that you will want others in the class to be able to read your labs, since you are collaborating with others on that material. However, you do not want others to be able to read your supplemental problems. These steps set up this framework.

  1. Move to your home directory.

    1. Allow others to read (but not change) your login directory with the command:

         chmod 755 .
      
    2. Next allow others to read (but not change) files in your labs directory:

         chmod 755 labs
      
    3. Now use the ls -l -a command to check that others can read your home directory and the labs subdirectory, but no other directories.

    4. Team up with another class member to check which directories of theirs you can read.

  2. Now suppose you set your home directory with the command:

       chmod 711 ~
    
    1. Can others obtain a listing of your home directory?

    2. Can others obtain a listing of your labs subdirectory?

    Consider what access you want others to have to your home directory and set it accordingly. Unless you want to protect a file against your own inadventent editing, you likely will want to retain 7 at the beginning of the chmod permission list.

Feedback Welcome

Development of laboratory exercises is an iterative process. Prof. Walker welcomes your feedback! Feel free to talk to him during class or stop by his office.