Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You've decided to start organizing your backup directory, particularly concerning log files. You want to create several subdirectories, each one a category that can pertain

You've decided to start organizing your backup directory, particularly concerning log files. You want to create several subdirectories, each one a category that can pertain to the backed-up logs. For example, you want to organize logs by type (e.g., authentication logs vs. app logs vs. kernel logs) and the year they were generated. However, most logs can apply to multiple categories. So, rather than have two or more distinct copies of each log, you decide to link these files together so that they're easier to manage.You also want to access log backups from your home directory quickly. So, you'll create a link in your home directory to a log in the backup directory.You will create a backup directory for authentication logs, create hard and symbolic links, and attempt to remove a link.SubmissionCapture screenshots of all tasks (including time-stamps) and submit on CANVAS for grading using Microsoft Word. Captures must include timestamps and dates.ObjectivesGiven a scenario, manage files and directoriesExercise MachineUse the CentOS 7 virtual machine from the Cyber Range environment.Hint: to access CentOS 7 virtual machine, select Cyber Range from the course canvas shell and power on the machineCreate a link to a log fileYou should switch to the root user for these exercises.Hint: sudo su1. Create directory /backup/log/.Hint: mkdir -p /backup/logConfirm that you created the /backup/log directory.2. Make /backup/log your current directory.Hint: cd /backup/log 3. Switch to the /var/log/ directoryHint: cd /var/log 4. Use the cp command to make a backup copy of the file /var/log/boot.log Hint: cp boot.log boot_backup.logHint: when permission is denied, use sudo to execute the command5. Create a hard link between /var/log/boot_backup.log and installations.logThis creates a hard link to the boot_backup.log in the /var/log directory.Hint: ln /var/log/boot_backup.log /backup/log/installation.logHint: when operation is not permitted, use sudo to execute the command 6. Verify that the installation.log file was created in the /backup/log directory.Hint:lsConfirm that you created the installations.log hard link.7. Use tail to display the contents of the /backup/log/installation.log file and verify that its contents are the same as the /var/log/boot_backup.log file.Note that the content of the file is very long, so using tail limits the display to just the end of a file.Both the /backup/log/insetallation.log and /var/log/boot_backup.log are links which point to the same content.Hint: tail /backup/log/installation.logtail /var/log/boot_backup.logYou could also run a diff of the two files, /var/log/boot_backup.log and /backup/log/installation.log if you want to be sure.Make a change in one file and see it reflected in the hard link fileRecall that hard links point to a single file. Suppose a file named configurations.txt exists. A hard link to it might reside in the user's home folder and a second hard link might reside in /opt. Both hard links point to the same file, and therefore both links will display the file's contents.1. Use the echo command to insert the word failed at the end of the boot_backup.log fileHint: echo failed >> boot_backup.log2. Search for the failed attempt entry by typing tail /var/log/boot_backup.log | grep -i failed3. Make a similar search for the entry in the /backup/log/installation.log file.Hint:tail /backup/log/installation.log | grep -i failed4. Repeat the above search for the failed string in /backup/log/installation.log but this time redirect the output to a file named fail.txtHint:tail /backup/log/installation.log | grep -i failed >> fail.txtRemove one file and verify that the hard link is still intact1. Remove the /backup/log/installation.log file from the /backup/log directory.When prompted, enter y to confirm the removal of the boot_backup.log file.Hint:rm /backup/log/installation.logConfirm that you removed the /backup/log/installation.log file.2. Verify that the hard link file's contents are still intact.Observe that the text failed is still displayed.Hint:tail /var/log/boot_backup.logtail /var/log/boot_backup.log | grep -i failCreate a symbolic link to the log fileYou will attempt to create a hard link, but the process will fail. Next, you will attempt a symbolic link, which succeeds because symbolic links can cross filesystems.1. Change to the root user's home directory.Hint:cd2. Attempt to create a hard link from /proc/meminfo to memory_info.txt in your home directory.Verify that the operation failed with an Invalid cross-device link message.Hint:ln /proc/meminfo memory_info.txtYou cannot create hard links across different file systems, and the home directory and the /proc directory are mounted on different file systems. You must create a soft (symbolic) link to work around this.3. Create a symbolic link from /proc/meminfo to memory_info.txt in your home directory.Hint:ln -s /proc/meminfo memory_info.txtConfirm that you created the symbolic link from /proc/meminfo to memory_info.txt in your home directory.Remove an original file and verify that the symbolic link is affected1. Verify that the root user's home directory is your current directory.Hint:pwdIf needed, then cd2. Create a new empty file via redirection named linktest with "This is a link test" as its content.Hint:echo "This is a link test" > linktest3. Make /opt your current directory.Hint:cd /opt4. Create a symbolic link from linktest to /opt/linked.Hint:ln -s ~/linktest linked5. Verify that the /opt/linked file exists.Hint:ls -l6. Now, remove the original file linktest from your home directory.Hint:rm ~/linktestWhen prompted, enter y to confirm file ~/linktest removal.7. Verify that the /opt/linked link to ~/linktest is broken.Hint:cat linkedYou should see a message that there's no such file or directory.8. Remove the /opt/linked broken link.Hint:rm linkedWhen prompted, enter y to confirm file ~/linktest removal.Confirm that you removed both the linktest and the /opt/linked file. He

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

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

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

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

Get Started

Students also viewed these Databases questions

Question

What are the objectives of Human resource planning ?

Answered: 1 week ago

Question

Explain the process of Human Resource Planning.

Answered: 1 week ago