Updated: 2013-04-22 09:12 EDT
PATH
for sysadmin work/home
directory to its own filesystemrsync
23h59 (11:59pm) Saturday April 13, 2013 (end of Week 13)
Assignments
directory from the CLS to your CentOS account in a previous assignment.rsync
Remember to READ ALL THE WORDS to work effectively and not waste time.
This is an overview of how you are expected to complete this assignment. Read all the words before you start working.
Since we also do manual marking of student assignments, your final mark may not be the same as the mark submitted using the current version of the Checking Program. We do not guarantee that any version of the Checking Program will find all the errors in your work. Complete your assignments according to the specifications, not according to the incomplete set of the mistakes detected by the Checking Program.
When you are finished the tasks, leave the files and directories in place as part of your deliverables. Do not delete any assignment work until after the term is over! Assignments may be re-marked at any time; you must have your term work available right until term end.
The previous term’s course notes are always available on the Internet here: CST8207 GNU/Linux Operating Systems I.
All the current and previous terms notes files are also stored on the CLS. You can learn about how to read and search these notes files using the command line on the CLS under the heading Copies of the CST8207 course notes near the bottom of the page Course Linux Server. The current CST8177 term notes are searchable there, too!
All references to the “Source Directory” below are to the CLS directory ~idallen/cst8177/13w/assignment09/
and that name starts with a tilde character followed by a userid with no intervening slash.
sudoers
groupAssignments
directory from the CLS to CentOSOn the Course Linux Server, make the directory ~/Assignments/assignment09
, in which some information will be stored related to this assignment, and also Create the check
symbolic link needed to run the Checking Program.
In your own account in your CentOS 5.8 VM, also make the directory ~/Assignments/assignment09
Create a full clone of your CentOS 5.8 VM, which we’ll call your Backup VM. Leave your Backup VM for now, we will return to it in later tasks.
Review your work from CST8207 GNU/Linux Operating Systems I.
fdisk, mkfs, mount, /etc/fstab
PATH
for sysadmin workAs a system administrator, you will need to run the utilities used for system administration (and other root-only commands). Starting a root
shell and working in it is dangerous, especially for new sysadmin who are not used to the dangerous power of super-user privileges where small typing mistakes can wipe out entire file systems. (This is you.)
Recall that when your userid is configured as a member of the sudoers
group, you can run sudo
command, where command is a command that needs root privileges to run, such as sudo pwck
. A safer thing to do is remain logged in as your ordinary, unprivileged system admin userid and to only use sudo
when you need to execute a specific, privileged root
command, e.g. sudo pwck
.
Unfortunately, your non-root
system administrator user’s PATH
is not yet set up for system administrator work using sudo
, because it doesn’t include any of the root
-only PATH
directories. You will need to update your PATH
so that sudo
will be able to find commands stored in /sbin
, /usr/sbin
, and /usr/local/sbin
, as follows:
.bashrc
file to add the root-only command directories/sbin
, /usr/sbin
, and /usr/local/sbin
to the right end of your PATH
environment variable, after the current PATH
directories but before your own personal $HOME/bin
directory, which should remain last.
PATH
modifications in Assignment #02.a=newstuff:$a
” would insert newstuff:
at the beginning of variable a
, and “a=$a:newstuff
” would append :newstuff
at the end of variable a
PATH
at the end of Slides 3 PDF.PATH
you are given by the system. You must add to the default path you are given, not replace it. Since the default path changes (it is different between CentOS and the CLS), you must not hard-code the system path into your own PATH
variable. Add to the default PATH
.Type source ./.bashrc
to have your current shell run the commands in .bashrc
and set your new PATH
, or log out and log back in if that doesn’t work. Make sure you have your new PATH
set.
Display the contents of your PATH
variable to verify your change. It should look something like this on CentOS (with abcd0001 being you own account userid):
/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/sbin:/home/abcd0001/bin
Run a command that you know is in a root-only directory, such as ifconfig
. Make sure the shell can find and run the command.
Now your PATH
variable is suitable for you to run individual root
commands using sudo
like this:
$ sudo admin_command [ arguments ... ]
where admin_command is any command that resides in one of the root
-only command directories that are now in your PATH
.
Use sudo
to run the pwck
command. You will need to type in your own password, not the root
password.
sudo
, synchronize your VM’s .bashrc
with its copy on the CLS so that the two files continue to be identical.
PATH
on the CLS may be different than on CentOS since the CLS is a Debian Linux system with different packages installed. You will always see /bin
and /usr/bin
in your PATH
.We will add a hard disk to your CentOS 5.8 VM, and partition it. The procedure for adding a hard disk to an actual physical computer is different only in the steps that take place while the machine is powered off. Any step carried out while the machine is running would be the same for physical machines as it is for virtual machines. The console of a physical machine is its actual keyboard and monitor, but in the case of a VM, the console is the VMware window of the machine.
If your CentOS 5.8 VM is not already powered off, login as your system administrator user, and power off the machine. Notice that CentOS 5.8
is configured by default to allow a regular user logged in directly to the console to run the /usr/bin/poweroff
(or /usr/bin/reboot
) command when no other users are logged in. If you are logged in over the network (with SSH, for example), you would need to use sudo
to run those commands as root
.
Using the Settings menu for your CentOS VM (not your Backup VM), add a 10G hard disk, accepting defaults for everything except the size. (You did similar work in CST8207 adding a VMware disk; review the notes.)
After adding the new disk, power on your VM, then login as your system administrator user.
/proc/partitions
file contains the disk you added.
10485760
.10485760/1024/1024
to confirm the number of gigabytes.On your CentOS VM, copy /proc/partitions
to assignment09/partitions_before.txt
for later use.
sudo
, run the command fdisk devicename
, where devicename is the absolute path of the device corresponding to the new disk. This will start the fdisk
program, just as you did in CST8207 Fdisk Command. Partition the new disk as follows:
fdisk
on the wrong disk. Make sure you use fdisk
on the new disk device name!+sizeM
where size
is the number of megabytes).fdisk
tells you as it quits whether you need to reboot for the new partition table to take effect. Do what it says.On your CentOS VM, copy the new version of /proc/partitions
(showing the new partitions you just created) to assignment09/partitions_after.txt
Use the diff
command to find the differences between the old and new assignment09/partitions_{before,after}.txt
and redirect the results to assignment09/partitions_diff.txt
Examine the differences file, and verify that your new partitions are the only differences. You should see four additional lines in the new partition file, corresponding to the four partitions you created:
6a7,10
> 8 17 497983 sdb1
> 8 18 1 sdb2
> 8 21 401593 sdb5
> 8 22 9582741 sdb6
/home
directory to its own filesystemWe will create an
ext4
filesystem on the primary partition of the new hard disk. Then, in single user mode, we will migrate the contents of the/home
directory to that new filesystem. We will configure the/etc/fstab
so that the new file system will be automatically mounted on/home
, with the option for giving the users disk space quotas.
Most of these system admin commands below will require you to prefix the actual command name with sudo
to gain root
permissions (unless you are in single-user mode and therefore running everything as root
). If you get “permission denied” errors, you forgot to use sudo
.
Take a snapshot of your CentOS VM.
Using sudo
, run a yum install
command to install the e4fsprogs
package.
Run using sudo
the command file -s /dev/
somedevice
to check the type of the device special file somedevice that corresponds to your new primary partition. Because it has nothing on it, you should see
/dev/sdb1: data
Using sudo
, format an ext4
file system on the primary partition on the new disk. (Review the CST8207 Partitioning and File Systems notes.)
Again (using sudo
) check the type of the device that corresponds to your new primary partition. It should be different now:
/dev/sdb1: Linux rev 1.0 ext4 filesystem data (extents) (huge files)
Using sudo
, also check the type of /dev/sda1
, which you are not expecting to have an ext4
filesystem.
Using sudo
, also check the type of /dev/sda2
, which you are expecting to be an LVM2 physical volume.
shutdown now
to do so.
runlevel
, which should show 1 S
whoami
and confirm that you are always the root
user when running in single-user mode. Be careful!Ensure your /home
directory is backed up, as follows: If you took a snapshot of your VM as previously instructed, and if your Backup VM is functional (verify this), then you can consider your /home
directory backed up. (On a non-VM system, you would copy /home
to a safe backup disk before you tried to move it.)
Record a recursive, sorted listing of all of the pathnames of your /home
directory using find /home | sort
, redirecting the output to a file named home_before.txt
in root
’s home directory. Your file should contain more than 130 lines, one for each pathname in the /home
directory.
/home
directory or any files under it, with lsof +D /home
/home
is not yet a mount point, you need to use the +D
option to include every directory under /home
./home
directory./home
.Note that if you don’t finish correctly the remaining steps in this section in one sitting before you reboot, your sysadmin account will be missing its HOME directory and you will get an error message about that when you log in. You must completely finish the remaining steps in this section correctly to regain log-in access to your sysadmin files in your HOME directory. Do not reboot your machine in this section, since the reboot will cause the
/home
directory to unmount and all your HOME directories, including the one for your sysadmin account, won’t work. You might want to take another snapshot here before you continue.
/home
directory to /old_home
/home
has been renamed and is therefore missing.Re-create a new empty /home
directory, which will be used as a mount point for the new file system you just created, above.
Mount the new file system that you just created on the new /home
mount point. (Review the mount
command in CST8207 Partitioning and File Systems.)
mount
command and confirm that you can see /dev/sdb1
mounted on the /home
directory. Do not proceed until this is true!
lost+found
directory under /home
now. Do not accidentally delete this directory! (If you delete it, read the man page for the mklost+found(8)
command and recreate it.)cp -a
to copy the contents of the old /old_home
directory to the new /home
file system.
/old_home
into /home
and do not copy the name /old_home
in to /home
!/home
and confirm that you do not see the old_home
directory name there.lost+found
directory.Record the list of all pathnames in /home
again, in the same way, sorted, except redirect the output into a new file home_after.txt
also in root
’s home directory.
Record the differences between the two home_{before,after}.txt
files, in a file named home_diff.txt
also in root
’s home directory. (The files should differ by exactly one line; the new HOME directory has one additional directory in it that wasn’t in the original. We’ve already told you what its name is.)
Add a record to the /etc/fstab
file so the new /home
file system is mounted automatically, with default options and added quota options for both users (usrquota
) and groups (grpquota
). (Review CST8207 Partitioning and File Systems for the format of /etc/fstab
.)
mount
command with the remount
option to remount the /home
filesystem according to the new options given in /etc/fstab
man mount
and look for the remount
section under the -o
flag (options).mount
command has errors, do not continue. Fix it!mount
command to verify that /home
is now remounted with the two quota options that you set in /etc/fstab
.
su -l
to temporarily become your sysadmin account and verify that your sysadmin HOME directory is valid and contains its usual files. Then exit your shell and return to the single-user shell.Return from single-user to runlevel 3 by typing exit
at the single-user shell.
Normally, you would remove the /old_home
directory, and everything beneath it to free up space on the /
filesystem, reaping the rewards of moving the /home
directory to its own filesystem; however, leave the /old_home
directory in place for marking purposes. Do not remove /old_home
.
sudo
, move all of the *.txt
files you created in the home directory for root
into your own Assignments/assignment09
directory, and then change the owner and group of those files from root
to yourself (your sysadmin user whose name is of the form abcd0001
).
sudo
. Why? (Hint: Who is running the shell that is doing the GLOB expansion before executing sudo
?)We will use LVM capabilities to extend the volume group
VolGroup00
using the first logical partition on the disk we added (the 400MB logical partition). Then we’ll grow theLogVol00
logical volume, and then we’ll grow the root filesystem that resides on that volume. Each step of the way, we’ll record the state before, then after, and record the difference.
You must be logged in to the CentOS VM as your own account.
Add the physical volume as follows:
On your CentOS VM, make your Assignments/assignment09
directory your current working directory.
Display the list of physical volumes on your VM with sudo pvdisplay
.
Run the command again, redirecting the output to pv_before.txt
Make the first logical partition on the new hard disk into a LVM physical volume, with the command sudo pvcreate /dev/sdb5
Display the attributes of that physical volume, with the command sudo pvdisplay /dev/sdb5
Display the list of all physical volumes on your VM as before.
Run the command again, redirecting the output to pv_after.txt
pv_{before,after}.txt
and redirect the output to pv_diff.txt
wc
output should be close to this:
$ wc pv_diff.txt
13 54 408 pv_diff.txt
Add the physical volume to the VolGroup00
volume group (assuming your volume group is named VolGroup00
– it might be named VolGroup01
or similar, and you’ll find out below) as follows:
sudo vgdisplay
.
VolGroup00
throughout this assignment.Run the command again, redirecting the output to vg_before.txt
VolGroup00
volume group, with the command sudo vgextend VolGroup00 /dev/sdb5
.
The command should display something like
Volume group "VolGroup00" successfully extended
Display the list of all volume groups on your VM, as before.
Run the command again, redirecting the output to vg_after.txt
Run a command to show the difference between vg_{before,after}.txt
and redirect the output to vg_diff.txt
, which should look something like this:
$ cat vg_diff.txt
5,6c5,6
< Metadata Areas 1
< Metadata Sequence No 3
---
> Metadata Areas 2
> Metadata Sequence No 4
13,15c13,15
< Cur PV 1
< Act PV 1
< VG Size 1.69 GB
---
> Cur PV 2
> Act PV 2
> VG Size 2.06 GB
17c17
< Total PE 54
---
> Total PE 66
19c19
< Free PE / Size 0 / 0
---
> Free PE / Size 12 / 384.00 MB
Extend the LogVol00
logical volume, as follows:
Display the list of all logical volumes on your VM, using sudo lvdisplay
.
Run the command again, redirecting the output to lv_before.txt
Grow the LogVol00
logical volume to consume all the space we just added to its volume group, with the command sudo lvextend -l+12 /dev/VolGroup00/LogVol00
, where in -l+12
, that’s an “minus-el” not a “minus-one”, and the number of physical extents, 12
, came from the last line vg_diff.txt
, or from the sudo vgdisplay
command whose output shows Free PE
(Physical Extents).
Display the list of all logical volumes on your VM.
Run the command again, redirecting the output to lv_after.txt
Run a command to show the difference between assignment09/lv_{before,after}.txt
and redirect the output to assignment09/lv_diff.txt
. Verify that the differences look right:
$ cat lv_diff.txt
8,10c8,10
< LV Size 1.34 GB
< Current LE 43
< Segments 1
---
> LV Size 1.72 GB
> Current LE 55
> Segments 2
Grow the root file system, as follows:
Run the command df -h
which will report file system disk space usage
Run the command again and redirect the output to df_before.txt
Run the command sudo resize2fs /dev/VolGroup00/LogVol00
to grow the root filesystem to consume all the space we just added to the logical volume on which it resides.
Check the new size of your root filesystem. Run the command that will report file system disk space usage and redirect the output to df_after.txt
Run a command to show the difference between assignment09/{df_after.txt,df_before.txt}
and redirect the output to df_diff.txt
. Verify that it looks right (similar to the following, but some of the exact numbers may differ slightly):
$ cat df_diff.txt
3c3
< 1.4G 833M 432M 66% /
---
> 1.7G 833M 787M 52% /
VMware Tools is a set of kernel modules and programs that provide better integration of your VM into your Host OS environment. For example, it will allow you to choose a set of Host OS directories to make available under the
/mnt/hgfs
directory of your VM filesystem. Also, it will adjust your VM’s clock after your VM is powered on or resumed. Physical machines have a battery-powered real time clock that is used to set the system time and date upon booting, but in a virtual machine, the Host machine’s clock together with VMware tools provides this function. VMware Tools is a software package distributed as a compressed tarball on a virtual CD that is inserted into your virtual DVD drive when you selectInstall VMware Tools
from the VM menu of your CentOS VM.
Take a snapshot of your CentOS VM.
Power on your CentOS VM if it isn’t already running.
Select Install VMware Tools
from the VM menu of your CentOS VM.
Run dmesg
to display boot-time messages, and grep for DVD
to find out what device name your DVD drive was assigned to when your machine booted. This is one way to find the name of the device you need to mount. The grep command should display a line like devname
: VMware Virtual IDE CDROM Drive, ATAPI CD/DVD-ROM drive
, where devname is a device name that you will find in the /dev
directory.
Mount your DVD device on a convenient mount point, as follows: The /media
directory customarily contains mount points for removable devices. Create a suitable mount point (e.g. /media/dvd
), and then on it, mount the device you found above. After you’ve successfully mounted the device, you can run the mount
command to view the currently mounted devices, and you should see a line /dev/
devname
on /media/dvd type iso9660 (ro)
, where devname is the name of the device you found in the previous step.
Look at the contents of the mounted DVD. You should see two files, one of them a compressed tar
archive named VMwareTools-9.9.9-999999.tar.gz
, where the digits represented by 9
’s will be specific to the version of VMware Tools you have.
Change your current working directory to a convenient place, like /tmp
You should make sure there will be enough space there, that is, that the file system that contains /tmp
has enough free space (three times the size of the compressed archive should be more than enough). Then use sudo tar
with options to extract the tar archive on the DVD into the current directory, (which is /tmp
).
vmware-tools-distrib
. Run the vmware-install.pl
script in that directory, with the command sudo vmware-tools-distrib/vmware-install.pl
, and read each message/question that appears as the install script runs. You should accept all defaults by pressing Enter. (Recall doing this same thing in CST8207 VMware Tools.)
[FAILED]
message for Mounting HGFS shares
.VMware Tools services
should say [OK]
.If the last line of output from the script does not say that it ejected the DVD, type a command to eject it using its device name in /dev/
Verify that it’s no longer mounted, using the mount
command.
All of the software has already been copied to its installation location, so you should clean up by removing all the vm* VM*
items from /tmp
.
/mnt/hgfs
directory on your CentOS VM.
sudo
set the date to approximately 5 minutes in the pastrsync
We will practice using
rsync
between your CentOS VM and your Backup VM. You will not useroot
privileges orsudo
to runrsync
To keep things simple, we will run thersync
command always on your CentOS VM, and that makes your CentOS the local machine (where thersync
command is run), and therefore your Backup VM will be the remote machine. We will remove a couple of directories from your Backup VM, and restore them with anrsync
transfer from your CentOS VM to your Backup VM. We’ll try this until we’re successful. Once we’ve successfully restored those directories, we’ll remove them from your Backup VM again, andrsync
a second time, redirecting the verbose output to a file.
With both your CentOS VM and your Backup VM running, login to both machines as your system administrator user. Stay in your home directory on both machines throughout these tasks.
backup-
abcd0001
(no spaces)./etc/hosts
and remember this number.sudo
to edit /etc/hosts
and change abcd0001 to backup-
abcd0001
, where abcd0001 is the previous hostname./etc/hosts
. The word count should not have changed. If it changed, you have an error./etc/sysconfig/network
and remember it.sudo
to edit /etc/sysconfig/network
and change abcd0001 to backup-
abcd0001
, where abcd0001 is the previous hostname./etc/sysconfig/network
. The word count should not have changed. If it changed, you have an error.hostname
and make sure the host name has been changed.Take a snapshot of your Backup VM.
Take a snapshot of your CentOS VM.
On your Backup VM, run /sbin/ifconfig
to find out its IP address.
ssh
to login to your Backup VM from your system administrator account on your CentOS VM, as follows:
ssh
10.0.0.1, where you use your Backup VM IP address instead of 10.0.0.1.yes
ssh
command on the local machine.hostname
to verify that you’ve just logged in to your Backup VM.exit
rsync
to transfer a single file, your .bashrc
, as follows:
.bashrc
on your CentOS VM, and that change is not present on your Backup VM.sum .bashrc
on both machines to verify they are different.Synchronize this change to your Backup VM by rsync
ing your CentOS VM .bashrc
to your Backup VM home directory by running the following command on your CentOS VM:
rsync -av .bashrc 10.0.0.1:
where you use your Backup VM IP address instead of 10.0.0.1.Run sum .bashrc
on both machines to verify they are now the same.
rsync
update of your assignment05
directory from your CentOS VM to your Backup VM and verify that no files are transferred. (If you see files transfer, you got the pathnames wrong. The directories are identical; nothing should transfer. Adjust your pathnames and try again until nothing is going to be transferred between the identical machines.)rsync
before doing the real thing, just to make sure that you have the pathnames correct!Assignments
directory from the CLS to your CentOS account.ls
to display a long listing of your Assignments/assignment09
directory to make sure that it really is on your Backup VM and it really is empty. The Backup VM will not contain any of the work done in this lab, since that work was done only in the CentOS VM. Do not proceed if you see files under assignment09
– you’re on the wrong machine!Assignments/assignment{01,09}
(two directories) and everything in them from your Backup VM.
Permission denied
errors from some of your Assignment 1 directories, and therefore those directories will not be removed. You can either ignore these errors or fix the permissions so that you can remove the directories.rsync
with the verbose option to synchronize your Assignments
directory from your CentOS VM to your Backup VM, preserving permissions, ownership, hard links, etc, as follows:
rsync
(below) that your CentOS VM is the source (on the “left” side when you’re on your CentOS VM) and your Backup VM (the remote machine with the :
when you’re on your CentOS VM) is the destination (on the “right” side).rsync
ing (below) from your CentOS VM (the local machine) to your Backup VM (the remote machine, with the IP address and the :
).rsync -avH --dry-run Assignments 10.0.0.1:
rsync -avH --dry-run Assignments 10.0.0.1:.
rsync -avH --dry-run Assignments 10.0.0.1:./
rsync -avH --dry-run Assignments/ 10.0.0.1:Assignments
rsync -avH --dry-run Assignments/ 10.0.0.1:Assignments/
rsync -avH --dry-run Assignments/ 10.0.0.1:Assignments/.
rsync -avH --dry-run Assignments/. 10.0.0.1:Assignments
rsync -avH --dry-run Assignments/. 10.0.0.1:Assignments/
rsync -avH --dry-run Assignments/. 10.0.0.1:Assignments/.
-v
) you used with rsync
, you should see only your two Assignments/assignment{01,09}
directories and contents being copied to your Backup VM. If you see more than this in the “dry run”, you have the pathnames wrong.Assignments/assignment{01,09}
to verify they are now the same as on your CentOS VM.
Assignments
directory ended up, and remove it, or restore your Backup VM snapshot to start over. Carefully review the command you ran on your CentOS VM, fix it, and try the previous task again. Repeat until you succeed, asking for help if necessary.Assignments/assignment{01,09}
rsync
of your Assignments directory to your Backup VM, except this time, redirect the verbose output to Assignments/assignment09/rsync_output.txt
On your CentOS VM, run an ssh
to your Backup VM to list all the Assignments
files in your Backup VM, and redirect the output to a file remlist.txt
in your assignment09
directory on your CentOS VM, as follows:
$ hostname
abcd0001
$ pwd
~/Assignments/assignment09
$ ssh 10.0.0.1 'find Assignments -ls' > remlist.txt
where you replace 10.0.0.1
with the IP address of your Backup VM. Note how the find
command runs on the remote Backup VM but the output file is created on the local CentOS VM.
Shut down your Backup VM.
If you find yourself locked out of a Linux machine, and you have access to the console, booting into single user mode will will often not require a password, and in single-user mode you can change passwords or perform various other repair tasks. (Some systems do password-protect single-user mode, in which case you would need to boot a “live” or “rescue” CD to reset your
root
password.)
Shutdown and reboot your CentOS VM, and when you see the GRUB menu and the countdown timer, halt the GRUB time-out it by pressing the space bar or an arrow key.
Use GRUB to edit your boot options so you boot into single user mode. (Refer to last term’s CST8207 Booting and GRUB.)
Verify that you are in single user mode: when you issue the command runlevel
, the output should be unknown
Note that you are running as root
and can change the password of any user in single-user mode, including the root
password.
Put the output of the command ps auxww
into a file named ps_auxww.txt
in your assignment09
directory, and change the ownership and group of this file to your ordinary sysadmin user. (Don’t leave root
-owned files in ordinary user accounts!)
Exit this single-user shell to boot into the default runlevel.
Log in and verify you’re in the default runlevel by issuing the runlevel
command.
If you find a Linux machine is unbootable, and you have console access, you may be able to rescue it by booting the machine from a “Live CD”. We will use the CentOS installation DVD to boot into “rescue” mode, which is a “Live CD” mode.
Power down your CentOS VM gracefully.
Insert the CentOS Installation ISO image file into your virtual DVD drive.
*.vmx
file*.vmx
file to give a longer pause on the VMware bios screen: bios.bootDelay = "60000"
CentOS-5
banner on the screen, and a small boot:
prompt in the lower left corner.
linux rescue
at the prompt, and press return.No
When you have a root prompt, cat
the password file to see that this is not your actual CentOS system running.
View a listing of /mnt/sysimage
to see that is where your root file system is mounted.
Save a copy of the Live CD’s password file, preserving timestamps, permissions, etc, to the file livecd_passwd.txt
in your assignment09
directory. The sum
of your livecd_passwd.txt
file should be 17749 1
Run the command chroot /mnt/sysimage
to obtain a shell running with that directory as its root directory.
Again, cat
the password file to see that your current root shell is seeing your actual root filesystem (and other programs you run from this prompt will too).
Note that you could fix your MBR with the command grub-install
at this point.
In the VMware VM Hardware CD/DVD tab, under Device Status, un-check Connect at power on and save the settings.
Take the virtual DVD out of the virtual DVD drive. (Disconnect it.)
root
owner or group files in your assignment09
directory.
root
-owned files as an indication that someone has broken into the system. Don’t leave root
-owned files in your own CentOS account.root
files in your CLS assignment directories. Don’t delete these!Run the Checking Program as described in the next sections.
When you are finished, run the Checking Program to create an overall mark. Submit the output to Blackboard in the correct location.
Since we also do manual marking of student assignments, your final mark may not be the same as the mark submitted using the current version of the Checking Program. We do not guarantee that any version of the Checking Program will find all the errors in your work. Complete your assignments according to the specifications, not according to the incomplete set of the mistakes detected by the Checking Program.
The checking program resides on the Course Linux Server, but your work is on your CentOS Virtual Machine. There is a new Fetch program that you must download and use on your CentOS machine to copy information from your CentOS Virtual Machine to your account on the CLS so that the checking program can check it on the CLS.
Once the Fetch program has fetched these files from your Virtual Machine to the CLS, you can run the checking program on the CLS to check what is saved in the files. When you make changes on your CentOS Virtual Machine, you need to run the Fetch program again to update the saved files on the CLS.
Simply running the checking program on the CLS will not update the saved files on the CLS. You must run the Fetch program when you make changes on your CentOS Virtual Machine.
Do all the following steps on your CentOS 5.8 VM. Read through the whole list before you start typing anything.
root
account (same userid as Blackboard).Assignments/assignment09
(exactly the same directory hierarchy as you already have on the CLS), unless you already have this directory.assignment09
directory.As shown below, use wget
to get a copy of the Fetch program from this URL into a file named do.sh
: http://teaching.idallen.com/cst8177/13w/notes/data/assignment09wget.sh
CentOS$ wget -O do.sh http://teaching.idallen.com/cst8177/13w/notes/data/assignment09wget.sh
Saving to: `do.sh'
Make sure you have a file named do.sh
in your directory. You only need to download this once per assignment.
As shown below, use sudo
and sh
to run the do.sh
script you just downloaded to CentOS with the USER
environment variable set to your own CLS account userid (as stored in the USER
variable).
CentOS$ sudo USER=$USER sh do.sh
This Fetch program will connect from CentOS to the CLS using your account name. It will copy files from CentOS to your assignment09
directory on the CLS. It will then run the checking program on the CLS to check your work. You will need to answer one question about your IP address, and then wait and type in your CLS password.
It will look something like this:
CentOS$ whoami
abcd0001
CentOS$ hostname
abcd0001
CentOS$ pwd
/home/abcd0001/Assignments/assignment09
CentOS$ wget -O do.sh http://teaching.idallen.com/cst8177/13w/notes/data/assignment09wget.sh
Saving to: `do.sh'
CentOS$ sudo USER=$USER sh do.sh
---------------------------------------------------------------------------
abcd0001: FETCH version 1. Connecting to CLS as USER='abcd0001' using ssh
---------------------------------------------------------------------------
abcd0001: Use local Algonquin IP cst8177-alg.idallen.ca [y/N]? n
abcd0001: Please wait; using ssh to connect to user 'abcd0001' on cst8177.idallen.ca ...
*** COURSE LINUX SERVER ***
abcd0001@cst8177.idallen.ca's password: # enter your CLS password
---------------------------------------------------------------------------
idallen-ubuntu assignment09fetch_server.sh version 0 run by abcd0001.
Please wait; collecting info from abcd0001 Virtual Machine
---------------------------------------------------------------------------
VM files collected into Assignments/assignment09/abcd0001.tar.bz on CLS.
Now running check program for abcd0001 on CLS:
----------------------------------------------------------------------------
idallen-ubuntu check: Assignments/assignment09 check program version 00
*** Checking account for abcd0001 on idallen-ubuntu ***
[... checking program output appears here ...]
assignment09
on the CLS..bashrc
file or world-writable files on the CLS). These errors are on the CLS, not on your CentOS machine.When you are done with your assignment, you need to run the checking program one last time on the CLS and submit the output file, as follows:
Do all this on the Course Linux Server:
There is a Checking Program named assignment09check
in the Source Directory on the CLS. Create a Symbolic Link to this program named check
under your new assignment09
directory so that you can easily run the program to check your work and assign your work a mark. Note: You can create a symbolic link to this executable program but you do not have permission to read or copy the program file.
Execute the above “check” program on the CLS using its symbolic link. (Review the CST8207 Search Path notes if you forget how to run a program by pathname from the command line.) This program will check your work, assign you a mark, and display the output on your screen. (You may want to paginate the long output so you can read all of it.)
You may run the “check” program as many times as you wish, to correct mistakes and get the best mark. Some tasks sections require you to finish the whole section before running the checking program at the end; you may not always be able to run the checking program successfully after every single task step.
When you are done with checking this assignment, and you like what you see on your screen, redirect the output of the Checking Program into the text file assignment09.txt
under your assignment09
directory on the CLS. Use the exact name assignment09.txt
in your assignment09
directory. You only get one chance to get the name correct. Case (upper/lower case letters) matters. Be absolutely accurate, as if your marks depended on it. Do not edit the file.
Transfer the above assignment09.txt
file from the CLS to your local computer and verify its contents. Do not edit this file! No empty files, please! Edited or damaged files will not be marked. You may want to refer to this term’s updated File Transfer notes.
Submit the assignment09.txt
file under the correct Assignment area on Blackboard (with the exact name) before the due date. Upload the file via the assignment09 “Upload Assignment” facility in Blackboard: click on the underlined assignment09 link in Blackboard. Use “Attach File” and “Submit” to upload your plain text file.
No word-processor documents. Do not send email. Use only “Attach File”. Do not enter any text into the Submission or Comments boxes on Blackboard; I do not read them. Use only the “Attach File” section followed by the Submit button. (If you want to send me comments about your assignment, use email.)
Your instructor may also mark the assignment09
directory in your CLS account after the due date. Leave everything there on the CLS. Do not delete any assignment work from the CLS until after the term is over!
Use the exact file name given above. Upload only one single file of plain text, not HTML, not MSWord. No fonts, no word-processing. Plain text only.
Did I mention that the format is plain text (suitable for VIM/Nano/Pico/Gedit or Notepad)?
NO EMAIL, WORD PROCESSOR, PDF, RTF, or HTML DOCUMENTS ACCEPTED.
No marks are awarded for submitting under the wrong assignment number or for using the wrong file name. Use the exact name given above.
WARNING: Some inattentive students don’t read all these words. Don’t make that mistake! Be exact.
READ ALL THE WORDS. OH PLEASE, PLEASE, PLEASE READ ALL THE WORDS!
Author:
| Todd Kelley / Richard Donnelly and
| Ian! D. Allen - idallen@idallen.ca - Ottawa, Ontario, Canada
| Home Page: http://idallen.com/ Contact Improv: http://contactimprov.ca/
| College professor (Free/Libre GNU+Linux) at: http://teaching.idallen.com/
| Defend digital freedom: http://eff.org/ and have fun: http://fools.ca/
Plain Text - plain text version of this page in Pandoc Markdown format
Author Ian! D. Allen