Answered step by step
Verified Expert Solution
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 backedup logs For example, you want to organize logs by type eg 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 timestamps 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 virtual machine from the Cyber Range environment.Hint: to access CentOS 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 su Create directory backuplogHint: mkdir p backuplogConfirm that you created the backuplog directory Make backuplog your current directory.Hint: cd backuplog Switch to the varlog directoryHint: cd varlog Use the cp command to make a backup copy of the file varlogbootlog Hint: cp boot.log bootbackup.logHint: when permission is denied, use sudo to execute the command Create a hard link between varlogbootbackup.log and installations.logThis creates a hard link to the bootbackup.log in the varlog directory.Hint: ln varlogbootbackup.log backuploginstallationlogHint: when operation is not permitted, use sudo to execute the command Verify that the installation.log file was created in the backuplog directory.Hint:lsConfirm that you created the installations.log hard link Use tail to display the contents of the backuploginstallationlog file and verify that its contents are the same as the varlogbootbackup.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 backuploginsetallationlog and varlogbootbackup.log are links which point to the same content.Hint: tail backuploginstallationlogtail varlogbootbackup.logYou could also run a diff of the two files, varlogbootbackup.log and backuploginstallationlog 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 Use the echo command to insert the word failed at the end of the bootbackup.log fileHint: echo failed bootbackup.log Search for the failed attempt entry by typing tail varlogbootbackup.log grep i failed Make a similar search for the entry in the backuploginstallationlog file.Hint:tail backuploginstallationlog grep i failed Repeat the above search for the failed string in backuploginstallationlog but this time redirect the output to a file named fail.txtHint:tail backuploginstallationlog grep i failed fail.txtRemove one file and verify that the hard link is still intact Remove the backuploginstallationlog file from the backuplog directory.When prompted, enter y to confirm the removal of the bootbackup.log file.Hint:rm backuploginstallationlogConfirm that you removed the backuploginstallationlog file Verify that the hard link file's contents are still intact.Observe that the text failed is still displayed.Hint:tail varlogbootbackup.logtail varlogbootbackup.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 Change to the root user's home directory.Hint:cd Attempt to create a hard link from procmeminfo to memoryinfo.txt in your home directory.Verify that the operation failed with an Invalid crossdevice link message.Hint:ln procmeminfo memoryinfo.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 Create a symbolic link from procmeminfo to memoryinfo.txt in your home directory.Hint:ln s procmeminfo memoryinfo.txtConfirm that you created the symbolic link from procmeminfo to memoryinfo.txt in your home directory.Remove an original file and verify that the symbolic link is affected Verify that the root user's home directory is your current directory.Hint:pwdIf needed, then cd 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" linktest Make opt your current directory.Hint:cd opt Create a symbolic link from linktest to optlinkedHint:ln s ~linktest linked Verify that the optlinked file exists.Hint:ls l Now, remove the original file linktest from your home directory.Hint:rm ~linktestWhen prompted, enter y to confirm file ~linktest removal Verify that the optlinked link to ~linktest is broken.Hint:cat linkedYou should see a message that there's no such file or directory Remove the optlinked broken link.Hint:rm linkedWhen prompted, enter y to confirm file ~linktest removal.Confirm that you removed both the linktest and the optlinked file. He
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 backedup logs For example, you want to organize logs by type eg 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 timestamps 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 virtual machine from the Cyber Range environment.Hint: to access CentOS 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 su Create directory backuplogHint: mkdir p backuplogConfirm that you created the backuplog directory Make backuplog your current directory.Hint: cd backuplog Switch to the varlog directoryHint: cd varlog Use the cp command to make a backup copy of the file varlogbootlog Hint: cp boot.log bootbackup.logHint: when permission is denied, use sudo to execute the command Create a hard link between varlogbootbackup.log and installations.logThis creates a hard link to the bootbackup.log in the varlog directory.Hint: ln varlogbootbackup.log backuploginstallationlogHint: when operation is not permitted, use sudo to execute the command Verify that the installation.log file was created in the backuplog directory.Hint:lsConfirm that you created the installations.log hard link Use tail to display the contents of the backuploginstallationlog file and verify that its contents are the same as the varlogbootbackup.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 backuploginsetallationlog and varlogbootbackup.log are links which point to the same content.Hint: tail backuploginstallationlogtail varlogbootbackup.logYou could also run a diff of the two files, varlogbootbackup.log and backuploginstallationlog 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 Use the echo command to insert the word failed at the end of the bootbackup.log fileHint: echo failed bootbackup.log Search for the failed attempt entry by typing tail varlogbootbackup.log grep i failed Make a similar search for the entry in the backuploginstallationlog file.Hint:tail backuploginstallationlog grep i failed Repeat the above search for the failed string in backuploginstallationlog but this time redirect the output to a file named fail.txtHint:tail backuploginstallationlog grep i failed fail.txtRemove one file and verify that the hard link is still intact Remove the backuploginstallationlog file from the backuplog directory.When prompted, enter y to confirm the removal of the bootbackup.log file.Hint:rm backuploginstallationlogConfirm that you removed the backuploginstallationlog file Verify that the hard link file's contents are still intact.Observe that the text failed is still displayed.Hint:tail varlogbootbackup.logtail varlogbootbackup.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 Change to the root user's home directory.Hint:cd Attempt to create a hard link from procmeminfo to memoryinfo.txt in your home directory.Verify that the operation failed with an Invalid crossdevice link message.Hint:ln procmeminfo memoryinfo.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 Create a symbolic link from procmeminfo to memoryinfo.txt in your home directory.Hint:ln s procmeminfo memoryinfo.txtConfirm that you created the symbolic link from procmeminfo to memoryinfo.txt in your home directory.Remove an original file and verify that the symbolic link is affected Verify that the root user's home directory is your current directory.Hint:pwdIf needed, then cd 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" linktest Make opt your current directory.Hint:cd opt Create a symbolic link from linktest to optlinkedHint:ln s ~linktest linked Verify that the optlinked file exists.Hint:ls l Now, remove the original file linktest from your home directory.Hint:rm ~linktestWhen prompted, enter y to confirm file ~linktest removal Verify that the optlinked link to ~linktest is broken.Hint:cat linkedYou should see a message that there's no such file or directory Remove the optlinked broken link.Hint:rm linkedWhen prompted, enter y to confirm file ~linktest removal.Confirm that you removed both the linktest and the optlinked file. He
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started