Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Here are the 10 files you will need. 1) colors red blue green light red light blue light green dark green dark red 2) course_directory

Here are the 10 files you will need.

1) "colors"

red blue green light red light blue light green dark green dark red

2) "course_directory"

/courses/it244/f13/ghoffmn

3) "day"

day I am looking for daylight night and day day after day after day

4) "fox"

The quick brown fox jumped over the lazy dogs.

5) "hosts"

127.0.0.1 localhost

6) "interfaces"

# This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5).

# The loopback network interface auto lo iface lo inet loopback

# The primary network interface auto eth0 iface eth0 inet dhcp

7) "letters_digits"

abcd 1234 5678

8) "new_night"

nite this is a new line night nighty night night night and day day and night all the live long night night after night after night

9) "night"

nite night nighty night night night and day day and night all the live long night night after night after night

10) "passwd"

root:x:0:0:root:/root:/bin/bash daemon:x:1:1:daemon:/usr/sbin:/bin/sh bin:x:2:2:bin:/bin:/bin/sh sys:x:3:3:sys:/dev:/bin/sh sync:x:4:65534:sync:/bin:/bin/sync man:x:6:12:man:/var/cache/man:/bin/sh lp:x:7:7:lp:/var/spool/lpd:/bin/sh mail:x:8:8:mail:/var/mail:/bin/sh news:x:9:9:news:/var/spool/news:/bin/sh uucp:x:10:10:uucp:/var/spool/uucp:/bin/sh proxy:x:13:13:proxy:/bin:/bin/sh www-data:x:33:33:www-data:/var/www:/bin/sh backup:x:34:34:backup:/var/backups:/bin/sh list:x:38:38:Mailing List Manager:/var/list:/bin/sh gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/bin/sh libuuid:x:100:101::/var/lib/libuuid:/bin/sh syslog:x:101:103::/home.ORIG/syslog:/bin/false mysql:x:102:105:MySQL Server,,,:/nonexistent:/bin/false messagebus:x:103:106::/var/run/dbus:/bin/false proxy:x:13:13:proxy:/bin:/bin/sh www-data:x:33:33:www-data:/var/www:/bin/sh backup:x:34:34:backup:/var/backups:/bin/sh list:x:38:38:Mailing List Manager:/var/list:/bin/sh gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/bin/sh libuuid:x:100:101::/var/lib/libuuid:/bin/sh syslog:x:101:103::/home.ORIG/syslog:/bin/false mysql:x:102:105:MySQL Server,,,:/nonexistent:/bin/false messagebus:x:103:106::/var/run/dbus:/bin/false bind:x:105:110::/var/cache/bind:/bin/false sysadmin:x:1000:1000:sysadmin,,,:/home/sysadmin:/bin/bash

Using sed - Part 2

Each team member must complete this assignment individually in his or her own it341 directory.

This project will not be done on your virtual machine.

Instead, it will be done on users.cs.umb.edu.

When I say "script" in this assignment, I am referring to something very different from the script utility, as used in Assignment #3.

The first line of each script file should be a "shebang" line:

#!/bin/bash

To make file changes in place, use sed with the -i option. Example:

 sed -i 's/Roses/Poinsettias/' roses.txt 

Rather than printing the change to standard output, it will change the file itself.To create a backup when changing a file, specify an extension for the backup file with the -i option. Example:

 sed -i.bak 's/Roses/Poinsettias/' roses.txt 

In addition to changing the file, the new file roses.txt.bak will contain the file's old contents.My grading process will include the following:

Copy pristine file copies into a folder.

Print the text of your script files.

Run the scripts.

Print the text files to verify their contents have changed.

You may see (a variation of) my grading script at the bottom of this page.

For another example, see the file roses_example.pdf

To be sure that these scripts work, you will likely need to run and test them multiple times. Each time, you should download new copies of the text files before testing your scripts.

NOTE: This assignment assumes that you are familiar with the process of writing and running bash scripts.

Log in to users.cs.umb.edu You will need an ssh client to do this.

Create and go to your it341/assign5 directory:

 mkdir it341/assign5 cd it341/assign5 

Copy practice files to this directory

 cp /home/ckelly/course_files/it341_files/* . 

The scripts you will write below will operate on the files you have just copied.Create the script interfaces_update.sh Write a shell script using sed commands that will make the following modifications to the interfaces file you have just copyChange the line

 iface eth0 inet dhcp 

to read

 iface eth0 inet static 

Add the following after this line

 network 10.0.0.0 address 10.0.0.201 gateway 10.0.0.1 broadcast 10.0.0.255 netmask 255.255.255.0 dns-nameservers 10.0.0.1 

Create the shell script hosts_update.sh Write a shell script using sed commands that will add the following lines to hosts

 # Gateway 10.0.0.1 it20.it.cs.umb.edu it20 # Addresses for the Windows PCs 10.0.0.240 it21.it.cs.umb.edu it21 10.0.0.241 it22.it.cs.umb.edu it22 10.0.0.242 it23.it.cs.umb.edu it23 10.0.0.243 it24.it.cs.umb.edu it24 10.0.0.244 it25.it.cs.umb.edu it25 10.0.0.245 it26.it.cs.umb.edu it26 10.0.0.246 it27.it.cs.umb.edu it27 10.0.0.247 it28.it.cs.umb.edu it28 

Create the shell script passwd_update.sh Write a shell script using sed commands that will modify the line

 sysadmin:x:1000:1000:sysadmin,,,:/home/sysadmin:/bin/bash 

so it reads

 sysadmin:x:1000:1000:sysadmin,,,:/home.it20/sysadmin:/bin/bash 

NOTE: Multiple lines in the passwd file may contain home, but your script should be written so that it is changed ONLY on the line for sysadmin.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

3. You can gain power by making others feel important.

Answered: 1 week ago