CT320: Network and System Administration

Fall 2018


CT320: Admin

The purpose of this assignment is to learn (or review) some of the standard system administration functions on a Linux system, including account administration, process control, and periodic processes. Use the script command to capture the output of all commands in R2.log, for submission at the end of the recitation.

Part 0 — How sudo and su work

sudo and su don’t really “change” your current user id. They run another instance of bash, called a sub-shell, with the permissions that you asked for. To stop having those permissions, type “exit” to terminate the shell, and you’ll go back to your previous shell with the previous permissions.

Use the id command to find out what user you are, at any time.

Part 1 — Account Administration

  1. Become the root user with sudo -s
  2. Use groupadd to define presidents, governors, mayors, and senators groups.
  3. Record the current GID for senators.
  4. Use groupmod to change the GID for senators.
  5. Use groupmod to restore the GID for senators.
  6. Use groupdel to delete the senators group.
  7. Use grep to search /etc/group for group names and GIDs.
  8. Use useradd to add users with the following attributes:
User NameHome  DirectoryPasswordShellPrimary GroupSecondary Group
  1. Login to the lincoln account and verify that the shell is /bin/bash.
  2. Use usermod to change the shell to /bin/sh for lincoln.
  3. Login to the lincoln account and verify that the shell has changed to /bin/sh.
  4. Use sudo and passwd to change the password for grant.
  5. Stop being root.
  6. Use su grant to login to the grant account.
    • Try the old password, to prove that it doesn’t work.
    • Use the new password to log in.
  7. Go back to being root.
  8. Use userdel to delete all the accounts that you added.

Part 2 — Process Control

  1. Stop being root. Do everything else as user ct320.
  2. In another window:
    • look at the manpage for ps.
  3. List the processes using ps with the -e, -f options.
  4. List only the processes owned by root. Use ps only—no grep or other filtering commands.
  5. List the process tree using the pstree command.
  6. In another window:
    • look at the manpage for the top command.
    • list the processes using top.
    • rerun top with half-second between screen updates.
    • rerun top only with your processes.
  7. Launch a gedit session and find its PID using ps and the -C option.
    • If gedit isn’t installed, then install it.
  8. Kill the gedit session using the kill command with the SIGKILL signal.

Part 3 — Periodic Processes

  1. In another window:
    • Look at the manpage for crontab: -e to edit, -l to list, -r to remove.
  2. Create a crontab file using crontab commands with the following attributes:
    • Runs every minute, every weekday, every month, etc.
    • Executes find -print from your home directory into R2.cron.
  3. Verify that the crontab is executing: grep -i cron /var/log/syslog
  4. Write a bash script called R2.script that executes ls -l in your home directory.
  5. The script should log results to a file called R2.cron in your home directory.
  6. The script should log the date and time each time it runs.
  7. Remove the original crontab entry and substitute a new one with the script.
  8. Have the script run with the same period as the previous crontab.
  9. Verify that the crontab is executing correctly by examining R2.cron.
  10. Use cat to list R2.script and R2.cron into R2.log.

Part 4 — Credit

  1. Terminate the script command with control-D.
  2. Edit your output to have only the relevant commands, filtering out all extraneous commands and output.
  3. Show it to the TA
  4. After the TA verifies things, delete the cron script, and remove R2.*.

User: Guest

Edit History Source

Modified: 2018-10-04T12:59

Apply to CSU | Contact CSU | Disclaimer | Equal Opportunity
Colorado State University, Fort Collins, CO 80523 USA
© 2018 Colorado State University
CS Building